-
Notifications
You must be signed in to change notification settings - Fork 25
feat: preserve empty folders on upload #1018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
834096f to
7f5187f
Compare
Replaces the Uppy drop target plugin by a custom one which is able to handle empty folders when uploading. Such empty folders get added to the Uppy upload queue temporarily so they can be identified and processed by our `HandleUpload` plugin later down the line.
f011c8e to
3998b4a
Compare
Changes the upload overlay to only count root level files and folders. This prevents confusion where the overlay would show less items than the count.
3998b4a to
9343226
Compare
0e77e2a to
7d0fffa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces functionality to preserve empty folders during upload by implementing a custom Uppy drop target plugin and utilizing the Directory API for browser-based folder uploads. The changes enable users to upload empty folders via drag & drop in all browsers and via the "Upload folder" button in Chromium-based browsers.
Key changes:
- Replaces the standard Uppy drop-target plugin with a custom implementation that can handle empty folders
- Adds Directory API support for folder uploads with fallback to native file picker
- Updates upload overlay to count only root-level items and make folders clickable
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/web-runtime/src/components/UploadInfo.vue | Updates naming from filesInProgressCount to itemsInProgressCount to reflect that both files and folders are tracked |
| packages/web-runtime/tests/unit/components/UploadInfo.spec.ts | Updates test variable names to match component changes |
| packages/web-pkg/src/services/uppy/DropTarget/ | Implements custom drop target plugin with empty folder support |
| packages/web-pkg/src/services/uppy/utils.ts | Adds utilities for creating folder dummy files and converting to Uppy format |
| packages/web-app-files/src/helpers/directoryPicker.ts | Implements Directory API integration for folder selection |
| packages/web-app-files/src/components/AppBar/Upload/ResourceUpload.vue | Updates upload trigger to use Directory API when available |
| packages/web-app-files/src/HandleUpload.ts | Enhances upload handling to process folder files separately from regular files |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/web-pkg/src/services/uppy/DropTarget/getDroppedFiles.ts:33
- Use
console.errorinstead ofconsole.logfor error logging to maintain consistency with other error handling in the codebase.
reader.readEntries(resolve, reject)
kulmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't find any issues, except for the one you described (folder upload button in non-chromium browsers). Code looks good as well. Let's merge this and wait for the next person complaining that the folder upload button doesn't work correctly in Safari or Firefox. 😅 Thank you for digging through this. 👏
Introduces usage of the Directory API for uploading folders and replaces the Uppy drop target plugin by a custom one which is able to handle empty folders when uploading. Empty folders get added to the Uppy upload queue temporarily so they can be identified and processed by our
HandleUploadplugin later down the line.Note that uploading empty folders with non-Chromium browsers only works via drag&drop! Clicking the "Upload folder" button won't work with them because of browser limitations.
Also changes the upload overlay to only count root level files and folders. This prevents confusion where the overlay would show less items than the count. Furthermore, folders in the upload overlay are now clickable (again - I think this broke at some point).
closes #821