aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/file-upload.js
Commit message (Collapse)AuthorAgeFilesLines
* chore(files): Remove legacy UI scripts now that everything is migrated to VueFerdinand Thiessen2024-09-201-1448/+0
| | | | Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* chore: Add SPDX headerAndy Scherzinger2024-05-291-8/+4
| | | | Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
* fix(files): legacy humanFileSize testsJohn Molakvoæ2023-10-041-5/+5
| | | | Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
* fix: Upload progress shows number of files to upload and current indexFerdinand Thiessen2023-08-211-6/+20
| | | | Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* fix: Make smooth bitrate and remaining upload time work when unsetFerdinand Thiessen2023-08-211-6/+6
| | | | Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* Smooth time remaining, bitrate and stabilize user informationPhlogi2023-08-211-14/+40
| | | | | | | | Besides the existing moving average, a smoothing factor is introduced for the time remaining display as well as the bitrate. Furthermore, half of the buffer needs to be filled before the first prediction is displayed to the user. This reduces volatile and jumping durations towards the user and improves usability. Signed-off-by: Cyrill H. <phlogi@posteo.de> Co-authored-by: Carl Schwan <carl@carlschwan.eu>
* feat(s3): Use multipart upload for chunked uploadingJulius Härtl2023-03-081-3/+16
| | | | | | This allows to stream file chunks directly to S3 during upload. Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Replace custom tooltips with native ones in filesjulia.kirschenheuter2022-12-221-2/+0
| | | | Signed-off-by: julia.kirschenheuter <julia.kirschenheuter@nextcloud.com>
* Also cancel XHR when cancelling uploadsVincent Petry2022-11-181-0/+9
| | | | | | Fixes issue when cancelling a long list of uploads. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
* Fix typos in apps/ subdirectoryluz paz2022-09-051-1/+1
| | | | | | | Found via `codespell -q 3 -S l10n,./apps/files_external/3rdparty -L adn,ba,boxs,keypair,jus,optionel,ressource,tabel ./apps/` Signed-off-by: luz paz <luzpaz@github.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
* Replace files app ids to classesVincent Petry2022-07-261-2/+2
| | | | | | | | | | | Replaced ids to classes for the following: - #filestable -> .files-filestable - #fileList -> .files-fileList - #controls -> .files-controls - #emptycontent -> .emptyfilelist.emptycontent Signed-off-by: Vincent Petry <vincent@nextcloud.com>
* Fix default toast message for failed uploads with HTTP/2Daniel Calviño Sánchez2022-06-141-1/+1
| | | | | | | | | | | | | | | | When an upload fails a toast is shown with either a specific message or just the textual part of the HTTP error code (which comes from the upload failure handler and set by "jQuery.ajax()". However, if there is neither a message nor an error then the toast will show the default message from the Toastify-js library, which is an undescriptive "Hi there!". When HTTP/2 is used Chromium does not provide the textual part of the HTTP error code, so when an upload fails the toast can receive an empty message and thus just show "Hi there!". Now an explicit message is provided as a fallback to prevent that. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Properly hide progress bar after errorVincent Petry2022-01-121-5/+16
| | | | | | | | | Whenever an error occurs, also hide the progress bar. The logic was also adjusted to properly detect uploads that are pending deletion, in which case the progress bar can already be hidden. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
* Properly abort uploadsVincent Petry2022-01-121-9/+36
| | | | | | | | | Add a new approach for flagging an upload as aborted because we can't rely on the browser fully cancelling the request as we now seem to receive an error response from the server instead of a jQuery "abort" message. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
* Typing correctionsLouis Chemineau2022-01-111-6/+6
| | | | Signed-off-by: Louis Chemineau <louis@chmn.me>
* refs #11864 handle empty dir drop in Files UIJulien Veyssier2021-11-081-0/+6
| | | | Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
* Merge pull request #28250 from pjft/patch-3Louis2021-10-141-1/+6
|\ | | | | Fix bug introduced on drag and drop external files
| * Fix bug introduced on drag and drop external filespjft2021-08-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drag and drop of external (OS filesystem) to subdirectories in the browser would fail on specific cases, mainly when the subdirectory was no longer off the root folder. This seemed to have been an issue introduced with the subdirectory free space calculation [here](https://github.com/nextcloud/server/commit/f9536b08096ed1c80391af36d33a18198be1fced) and it seems to fail for any subdirectory that doesn't belong to the root folder. Bug reports: - https://help.nextcloud.com/t/drag-drop-into-subfolders/120731 - https://github.com/nextcloud/server/issues/24720 I couldn't find any reference on scenarios or quota management that would suggest when a subdirectory's free space would be different to the parent's free space, other than when on the root folder, where subdirectories can be external mounts. As such, if my understanding is correct (please review), this calculation can - and should - be made by getting the free space from the first subdirectory in the total path, which caters for all subdirectory scenarios. Please advise, happy to help improve this. Co-authored-by: John Molakvoæ <skjnldsv@users.noreply.github.com> Signed-off-by: pjft <pjft@users.noreply.github.com>
* | Change the concurrent upload limit to less than 10szaimen2021-08-081-1/+1
|/ | | | Signed-off-by: szaimen <szaimen@e.mail.de>
* file-upload: Correctly handle error responses for HTTP2Jakub Onderka2021-03-101-1/+1
| | | | Signed-off-by: Jakub Onderka <ahoj@jakubonderka.cz>
* Fix total upload size overwritten by next uploadDaniel Calviño Sánchez2020-12-231-1/+4
| | | | | | | | | | | | | | | | | | | The upload progress is based on the "totalToUpload" variable. However, as the variable is set when an upload is submitted, if another upload is submitted before the previous one finished the upload progress only took into account the size of the new upload (although the upload itself worked fine; the files of the new submitted upload are added to the active one). Now "totalToUpload" is either increased or set depending on whether an upload is active or not. Note that although "data.total" holds the total size of the files being uploaded "totalToUpload" needs to be used in "fileuploadprogressall" instead; "totalToUpload" is calculated when the upload is submitted, but since 7c4c5fe6ae91 the actual upload of the files, and thus updating the value of "data.total", may be deferred until the parent folders were created. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Check for target folder available quota when uploadingJulius Härtl2020-11-171-3/+10
| | | | | Signed-off-by: Julius Härtl <jus@bitgrid.net> Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Better error message when blocked by access controlJoas Schilling2020-09-041-0/+2
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix IE11 upload fallback methodsJohn Molakvoæ (skjnldsv)2020-04-221-2/+26
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Remove deprecated global variablesChristoph Wurst2020-03-091-6/+6
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Also set X-OC-Mtime header for files that are smaller than 10MBJulius Härtl2019-11-071-0/+4
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Comply to eslintJohn Molakvoæ (skjnldsv)2019-10-011-5/+5
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Update file-upload.jsValdnet2019-05-091-1/+1
| | | Change the location of the translation file.
* [app:files] Use current directory for hashing.Evilham2019-03-131-4/+3
| | | | | | | | | | This fixes collisions that were causing uploads to break in a very terrible way. Kudos to @kesselb for finding the problematic place and to @hottwister for the proposed solution. Fixes #10527.
* Limit number of simultaneous MKCOL requests to server to increase upload ↵Tomasz Grobelny2019-02-161-18/+23
| | | | | | reliability Signed-off-by: Tomasz Grobelny <tomasz@grobelny.net>
* Merge branch 'master' into operation_progress_improvements3Tomasz Grobelny2019-01-291-5/+8
|\ | | | | | | Signed-off-by: Tomasz Grobelny <tomasz@grobelny.net>
| * Fix dropping a folder on a folder rowDaniel Calviño Sánchez2019-01-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Throttle getstoragestats.php calls and allow simultaneous uploadsTomasz Grobelny2019-01-271-1/+2
| | | | | | | | Signed-off-by: Tomasz Grobelny <tomasz@grobelny.net>
| * apps: file-upload: fix typo in commentsTigran Mkrtchyan2019-01-211-2/+2
| | | | | | | | Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
| * Do not show general warning on free space errorRoeland Jago Douma2018-12-051-1/+1
| | | | | | | | | | | | | | | | Fixes #12588 Probably needs more fixing for the other cases. But this is the quick fix I could come up with for now. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* | Move progress bar to separate componentTomasz Grobelny2018-11-241-22/+12
| | | | | | | | Signed-off-by: Tomasz Grobelny <tomasz@grobelny.net>
* | Restructuring code in file-upload.jsTomasz Grobelny2018-11-241-27/+37
|/ | | | Signed-off-by: Tomasz Grobelny <tomasz@grobelny.net>
* Ask before cancelling an ongoing uploadJohn Molakvoæ (skjnldsv)2018-11-051-5/+24
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Do not hide the progress bar while the chunked upload is being assembledDaniel Calviño Sánchez2018-09-071-1/+48
| | | | | | | | | | | | | | | Large files are not uploaded in a single operation, but uploaded in several chunks; once all the chunks are uploaded then the server needs to assemble them to get the final file. Before, once the chunks were uploaded the progress bar was hidden. However, this was confusing for the users, as the file could still need some time to appear in the file list due to the assembling. Now once all the chunks are uploaded the text in the progress bar changes to inform the user that there are still some pending operations, and only when the file is finally assembled the progress bar is hidden. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Do not show an error message when draging and dropping textDaniel Calviño Sánchez2018-06-081-0/+10
| | | | | | | | | | | When the browser reports a drag of items other than files (for example, text) and then triggers a drop event with no files no error message should be shown to the user, as in that case there would be no highlight of the drop zone and no indication that the drop would be valid (except for the mouse cursor); the error message should be shown only when the drop event with no files follows a file drag. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Remove no longer needed special handling for FirefoxDaniel Calviño Sánchez2018-06-081-15/+8
| | | | | | | | | | The highlighting was removed in Firefox when the cursor was no longer moving to handle the behaviour of reporting a file drag and then providing no files in the drop event. That behaviour (which was only present in Firefox 48 and 49) is already handled with the "dropnofiles" callback, so that special handling is no longer needed. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Use "dropnofiles" callback to disable the drop state in the UIDaniel Calviño Sánchez2018-06-081-0/+10
| | | | | | | | | | | | | | | | | | When a file is dragged from the desktop to the file list the file list is highlighted, and when the file is finally dropped or the drag operation is cancelled the highlighting is removed. In some cases, due to a wrong implementation, a browser may end a file drag with a drop with no files (for example, when a folder or text is dragged), which would cause the highlight to not be removed. Now those cases are handled with the "dropnofiles" callback, which restores the UI and also shows a message to the user. The error message is just a generic one, as in some cases it is not even possible to know whether the problem came from a text drag or a folder drag, and whether the problem appears or not depends on the browser, version and even operating system. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Remove duplicated codeDaniel Calviño Sánchez2018-06-081-6/+1
| | | | | | | "disableDropState" was set as the event handler in 8d4e5747f386a0, but the duplicated code was accidentally added back in 786e858d23c4a4. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Fix race condition when preparing upload folderDaniel Calviño Sánchez2018-04-221-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | Before any upload is submitted the upload is registered in a list of known uploads; this is needed to retrieve the upload object at several points of the upload process. When a chunked upload is submitted first a directory to upload all the chunks is created and, once that is done, the chunks are sent; in order to send a chunk the upload object needs to be retrieved from the list of known uploads. When all the active uploads were finished the list of known uploads was cleared. However, an upload is not active until it actually starts sending the data, so while waiting for the upload directory to be created the upload is already in the list of known uploads yet not active. Due to all this, if the active uploads finished while another pending upload was waiting for the upload directory to be created that pending upload would be removed from the list of known uploads too, and once the directory was created and thus the chunks were sent a field of a null upload object would be accessed thus causing a failure. Instead of removing all the known uploads at once when the active uploads finish now each upload is explicitly removed when it finishes. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Fix progress bar hidden before the upload endsDaniel Calviño Sánchez2018-04-051-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The jQuery File Upload plugin triggers the "stop" event once there are no more files being uploaded (even if some of them were added when another upload was already in progress). Therefore, the progress bar should be hidden in the "fileuploadstop" callback. In some cases the "stop" event is not triggered and thus the progress bar is not hidden once no more files are being uploaded. This is caused by a race condition and it will be fixed in another commit; except in buggy cases like that one (that need to be fixed anyway) it is safe to hide the progress bar in the "fileuploadstop" callback. In any case, note that the callbacks in "fileuploaddone" may be called after the "stop" event was triggered and handled when using chunked uploads. In that case once all the chunks are uploaded the assembled file is moved to its final destination, so its promise could be resolved after the "stop" event was triggered. Therefore a different approach would be needed to keep the progress bar visible until the chunked upload is truly finished, but for the time being the current one is good enough. Before this commit the progress bar was being hidden when the first upload finished, either successfully or with an error, no matter if there were other files being uploaded too. The progress bar was being explicitly hidden also when the upload was cancelled. When an upload is cancelled all the single uploads are aborted, which triggers a "fail" event for each of them. However, the "stop" event is always triggered when no more files are being uploaded, so it is triggered too once all the single uploads were aborted. As all the single uploads are immediately aborted in a loop when the general upload is cancelled it makes no difference to hide the progress bar when the first single upload is aborted or when all the single uploads were aborted, so the progress bar is no longer explicitly hidden in the former case. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Don't encode paths passed to the OC.Files.ClientRoeland Jago Douma2018-01-101-7/+7
| | | | | | | This is handled already in the client. So double encoding breaks things in some situations. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Merge pull request #7533 from ↵Morris Jobke2018-01-031-1/+12
|\ | | | | | | | | nextcloud/oc-28545-handle-oc-total-length-in-new-chunking [oc] Handle OC-Total-Length in new chunking
| * Only set X-OC-Mtime when browser provided lastModified on uploadVincent Petry2017-12-151-4/+12
| | | | | | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Transmit OC-Total-Length in browser as wellThomas Müller2017-12-151-1/+4
| | | | | | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* | Update quota on file upload and deletionJohn Molakvoæ (skjnldsv)2017-12-211-1/+1
|/ | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>