Skip to content
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

feat: Allow to upload directories and allow bulk upload #1175

Merged
merged 4 commits into from
May 15, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Apr 26, 2024

Added a Directory class that allows creating a virtual filesystem.
Meaning the directory contains a tree of child nodes.

Then this tree is uploaded level by level within the uploader (new method bulkUpload).

The UploadPicker now also support directories when created with allow-folders.


image

@susnux susnux added enhancement New feature or request 2. developing Work in progress labels Apr 26, 2024
@susnux susnux force-pushed the feat/allow-upload-directories branch from 0a5ba1e to ef945ce Compare April 28, 2024 15:18
@susnux susnux changed the base branch from main to fix/conflict-picker April 28, 2024 15:18
@susnux susnux force-pushed the feat/allow-upload-directories branch from ef945ce to 1ef79f3 Compare April 29, 2024 11:09
Base automatically changed from fix/conflict-picker to main April 29, 2024 11:14
@susnux susnux force-pushed the feat/allow-upload-directories branch from 1ef79f3 to 5b86d5d Compare April 29, 2024 13:59
@susnux susnux added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Apr 29, 2024
@susnux susnux marked this pull request as ready for review April 29, 2024 14:01
@susnux susnux force-pushed the feat/allow-upload-directories branch from 5b86d5d to 47c0ea4 Compare April 29, 2024 14:01
lib/uploader.ts Outdated Show resolved Hide resolved
lib/components/UploadPicker.vue Outdated Show resolved Hide resolved
lib/components/UploadPicker.vue Outdated Show resolved Hide resolved
lib/uploader.ts Outdated Show resolved Hide resolved
lib/uploader.ts Outdated Show resolved Hide resolved
lib/components/UploadPicker.vue Outdated Show resolved Hide resolved

try {
const content = path === '' ? this.currentContent : await this.getContent(path).catch(() => [])
const conflicts = getConflicts(nodes, content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does getCOnflicts also check conflicts on folders and does it recursively? Or maybe the nodes list is flat?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually what happens when the user upload a folder with a name that is already taken by another folder?
Is the new folder name updated? Or is the new folder merged into the existing one?
If the last option is used, it means that we have to recursively get the folder content to check for conflicts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conflicts are resolved recursively like your file manager does on your OS.
getConflicts only gets conflicts in the current level, then it lets you decide what todo:

  • Select the new one (aka "write into")
  • Select the old one (aka skip the upload)
  • Select both: Rename the new one

@susnux susnux force-pushed the feat/allow-upload-directories branch 2 times, most recently from 2f43c3d to 321331b Compare April 29, 2024 16:10
@susnux susnux requested a review from artonge April 29, 2024 16:11
@susnux
Copy link
Contributor Author

susnux commented Apr 29, 2024

Testing is possible with this server PR: nextcloud/server#45095

Just checkout the server link the upload package and build :)

@susnux susnux force-pushed the feat/allow-upload-directories branch from 321331b to c330da5 Compare May 3, 2024 15:06
susnux added 4 commits May 4, 2024 12:48
This is required for uploading folders, as `<input type="file" webkitdirectory />`
will provide a flat array of files with just the relative path provided.
So we can build the virtual file tree and upload layer by layer.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux force-pushed the feat/allow-upload-directories branch from c330da5 to 538c31e Compare May 4, 2024 10:48
@skjnldsv skjnldsv merged commit a6b4d1a into main May 15, 2024
14 checks passed
@skjnldsv skjnldsv deleted the feat/allow-upload-directories branch May 15, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants