nextcloud-server/apps/files/js
Daniel Calviño Sánchez 038e665db9 Fix dropping a folder on a folder row
When the uploaded files have a relative path (that is, when a folder is
uploaded) it is first ensured that all the parent folders exist, which
is done by trying to create them. When a folder is created in the
currently opened folder the file list is updated and a row for the new
folder is added. However, this was done too when the folder already
existed, which caused the previous row to be removed and a new one added
to replace it.

For security reasons, some special headers need to be set in requests;
this is done automatically for jQuery by handling the "ajaxSend" event
in the document. In the case of DAV requests, if the headers are not set
the server rejects the request with "CSRF check not passed".

When a file or folder is dropped on a folder row the jQuery upload
events are chained from the initial drop event, which has the row as its
target. In order to upload the file jQuery performs a request, which
triggers the "ajaxSend" event in the row; this event then bubbles up to
the document, which is then handled by adding the special headers to the
request.

However, when a folder was dropped on a folder row that folder row was
removed when ensuring that the folder exists. The jQuery upload events
were still triggered on the row, but as it had been removed it had no
parent nodes, and thus the events did not bubble up. Due to this the
"ajaxSend" event never reached the document when triggered on the
removed row, the headers were not set, and the upload failed.

All this is simply fixed by not removing the folder row when trying to
create it if it existed already.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-01-29 13:04:19 +07:00
..
templates Add icon to file sidebar tabs 2018-10-18 15:54:17 +07:00
admin.js Do not error on maxUploadChange 2016-08-22 20:25:58 +07:00
app.js Only check whatsnew once per hour 2018-12-20 20:09:05 +07:00
breadcrumb.js Remove deprecated SVG helpers for old IEs 2018-10-08 16:33:41 +07:00
detailfileinfoview.js Make file actions work from sidebar 2015-08-12 17:30:20 +07:00
detailsview.js Fix rendering of the sidebar in Files app 2018-11-22 05:58:25 +07:00
detailtabview.js Merge pull request #11647 from nextcloud/make-possible-for-tab-views-to-add-css-classes-to-their-container 2018-10-31 15:37:48 +07:00
favoritesfilelist.js Remove event handler no longer needed 2018-10-21 20:21:59 +07:00
favoritesplugin.js Fix jsdocs build on server repo 2018-10-24 15:41:08 +07:00
file-upload.js Fix dropping a folder on a folder row 2019-01-29 13:04:19 +07:00
fileactions.js fix testing for undefined 2019-01-16 22:54:16 +07:00
fileactionsmenu.js Move fileactionsmenu to compiled handlebars 2018-10-15 15:51:40 +07:00
fileinfomodel.js added quit option in commentstabview.js 2017-03-23 13:12:29 +07:00
filelist.js changed case on variable to match initial case 2019-01-25 11:16:37 +07:00
filemultiselectmenu.js Move the filemultiselectmenu over to compiled handlebars 2018-10-01 17:15:08 +07:00
files.js Throttle getstoragestats.php calls and allow simultaneous uploads 2019-01-27 22:59:14 +07:00
filesummary.js Move to 1 template file for files 2018-10-01 17:15:07 +07:00
gotoplugin.js Fix closing details view when viewing file in folder 2017-04-25 17:45:42 +07:00
jquery-visibility.js update jquery-visibility in files app 2015-08-17 09:39:21 +07:00
jquery.fileupload.js Add callback to clean up after misbehaved drag and drop events 2018-06-08 19:15:27 +07:00
keyboardshortcuts.js Fixed many issues, clean up 2014-05-15 17:51:04 +07:00
mainfileinfodetailview.js Remove OC.scaleFixForIE8 2018-10-08 16:17:16 +07:00
merged-index.json Move to 1 template file for files 2018-10-01 17:15:07 +07:00
navigation.js Replace ChildNode.before with custom before helper 2018-12-21 12:03:34 +07:00
newfilemenu.js Add missing variable declarations 2018-10-19 20:17:55 +07:00
recentfilelist.js block user sorting in recent files 2016-07-22 15:20:55 +07:00
recentplugin.js Fix jsdocs build on server repo 2018-10-24 15:41:08 +07:00
search.js Added new search standard 2018-06-19 23:53:20 +07:00
sidebarpreviewmanager.js Add missing variable declarations 2018-10-19 20:17:55 +07:00
sidebarpreviewtext.js Do not fetch the whole text file for the sidebar preview 2017-08-03 20:32:59 +07:00
tagsplugin.js Fix jsdocs build on server repo 2018-10-24 15:41:08 +07:00
templates.js Add icon to file sidebar tabs 2018-10-18 15:54:17 +07:00
upload.js Improved Javascript docs for JSDoc 2014-10-31 13:43:30 +07:00