nextcloud/apps/files/js
Daniel Calviño Sánchez 6fb6f3872e 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 14:47:46 +00:00
..
templates Upload autorename on client side 2016-11-02 22:15:03 +01:00
admin.js Do not error on maxUploadChange 2016-08-22 20:25:58 +02:00
app.js Fixed scrolling container 2018-07-24 11:01:11 +02:00
breadcrumb.js Merge pull request #8588 from nextcloud/fix-breadcrumbs-width-calculation 2018-03-01 20:13:26 +01:00
detailfileinfoview.js Make file actions work from sidebar 2015-08-12 17:30:20 +02:00
detailsview.js Fix rendering of the sidebar in Files app 2018-11-22 17:45:46 +01:00
detailtabview.js Hide sidebar tab headers conditionally 2015-09-28 14:57:44 +02:00
favoritesfilelist.js Remove event handler no longer needed 2018-10-23 16:44:29 +02:00
favoritesplugin.js Fix opening a section again in the Files app 2018-10-23 16:44:26 +02:00
file-upload.js Fix dropping a folder on a folder row 2019-01-29 14:47:46 +00:00
fileactions.js Object.values polyfill 2018-08-16 07:43:57 +02:00
fileactionsmenu.js Add support to FileActionsMenu for icon class functions 2017-10-19 01:46:13 +02:00
fileinfomodel.js added quit option in commentstabview.js 2017-03-23 13:12:29 -06:00
filelist.js Merge pull request #12598 from nextcloud/stable14-12577-fix-rendering-of-the-sidebar-in-files-app 2018-11-23 08:51:22 +01:00
filemultiselectmenu.js Fixes issues found during running of test cases. 2018-06-18 07:39:44 +02:00
files.js Fixup! removed unwanted line 2018-01-03 17:55:53 +01:00
filesummary.js Translate file summary connector (#26221) 2016-09-27 18:38:56 +02:00
gotoplugin.js Fix closing details view when viewing file in folder 2017-04-25 17:45:42 +02:00
jquery-visibility.js update jquery-visibility in files app 2015-08-17 09:39:21 +02:00
jquery.fileupload.js Add callback to clean up after misbehaved drag and drop events 2018-06-08 19:15:27 +02:00
keyboardshortcuts.js Fixed many issues, clean up 2014-05-15 17:51:04 +02:00
mainfileinfodetailview.js Hide favourite icon in details view if favourite action is not available 2018-01-05 19:06:06 +01:00
merged-index.json Added a new action menu in files and trash list. 2018-06-18 07:39:43 +02:00
navigation.js Replace ChildNode.before with custom before helper 2018-12-21 13:21:52 +00:00
newfilemenu.js Trigger upload actions only for Enter & Space keys 2018-07-24 19:02:56 +02:00
recentfilelist.js block user sorting in recent files 2016-07-22 15:20:55 +02:00
recentplugin.js Fix opening a section again in the Files app 2018-10-23 16:44:26 +02:00
search.js Added new search standard 2018-06-19 23:53:20 +02:00
sidebarpreviewmanager.js Make filelist and sidebar use the fileid preview endpoint 2018-01-24 11:24:18 +01:00
sidebarpreviewtext.js Do not fetch the whole text file for the sidebar preview 2017-08-03 20:32:59 +02:00
tagsplugin.js Fix fav quickaccess ressource addition 2018-07-13 09:57:54 +02:00
upload.js Improved Javascript docs for JSDoc 2014-10-31 13:43:30 +01:00