nextcloud/apps/files
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 +01:00
..
ajax Replace hardcoded status headers with calls to http_response_code() 2018-06-26 16:14:15 +02:00
appinfo Bump versions of server and the requirements of apps 2018-11-23 10:28:40 +01:00
composer Shorten index name of calendar changes table 2018-11-14 10:14:23 +01:00
css Merge pull request #13567 from nextcloud/fix/deuglify-upload-progress 2019-01-21 13:54:04 +01:00
img Js magic for deleted shares 2018-07-05 12:43:57 +02:00
js Fix dropping a folder on a folder row 2019-01-29 13:04:19 +01:00
l10n [tx-robot] updated from transifex 2019-01-22 01:12:25 +00:00
lib Make the yellow favorite icon non-monochrome 2019-01-22 16:13:29 +01:00
templates Implemented short quota-design v2 2019-01-03 18:47:30 +01:00
tests Add abort stub in JSUnit 2018-12-06 12:00:09 +01:00
.l10nignore Add .l10nignore files for compiled assets 2018-10-19 10:29:36 +02:00
list.php Rollback to default list view 2018-11-15 20:29:10 +01:00
recentlist.php Rollback to default list view 2018-11-15 20:29:10 +01:00
simplelist.php Rollback to default list view 2018-11-15 20:29:10 +01:00