Skip to content

Conversation

@JammingBen
Copy link
Contributor

@JammingBen JammingBen commented Jul 28, 2025

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 HandleUpload plugin 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

@JammingBen JammingBen self-assigned this Jul 28, 2025
@JammingBen JammingBen force-pushed the feat/preserve-empty-folders branch 12 times, most recently from 834096f to 7f5187f Compare July 31, 2025 08:39
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.
@JammingBen JammingBen force-pushed the feat/preserve-empty-folders branch from f011c8e to 3998b4a Compare July 31, 2025 13:34
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.
@JammingBen JammingBen force-pushed the feat/preserve-empty-folders branch from 3998b4a to 9343226 Compare August 1, 2025 07:33
@JammingBen JammingBen force-pushed the feat/preserve-empty-folders branch from 0e77e2a to 7d0fffa Compare August 1, 2025 11:27
@JammingBen JammingBen marked this pull request as ready for review August 1, 2025 11:41
Copilot AI review requested due to automatic review settings August 1, 2025 11:41
Copy link
Contributor

Copilot AI left a 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.error instead of console.log for error logging to maintain consistency with other error handling in the codebase.
      reader.readEntries(resolve, reject)

Copy link
Contributor

@kulmann kulmann left a 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. 👏

@JammingBen JammingBen merged commit 22ceecb into main Aug 6, 2025
29 checks passed
@JammingBen JammingBen deleted the feat/preserve-empty-folders branch August 6, 2025 06:44
@openclouders openclouders mentioned this pull request Aug 6, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

empty folder is not uploaded

3 participants