镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(filesDrop): drag-and-drop folder upload - #59294

Merged
susnux merged 2 commits into
masterfrom
dragDropDirCreate
Mar 31, 2026
Merged

susnux merged 2 commits into
masterfrom
dragDropDirCreate

Conversation

@solracsf

@solracsf solracsf commented Mar 29, 2026 •

Copy link
Copy Markdown
Member

Summary

When dragging and dropping a folder structure into any non-root destination (group folders, subfolders), subdirectories were created at the wrong WebDAV path. For team folders, the directory was created in the user's personal files entirely. Files then failed to upload because the target directory didn't exist in the team folder.

The fix: pass the destination (IFolder) to createDirectoryIfNotExists so it uses destination.source as its WebDAV base URL, as uploader.upload already does.


Please note: the bug affects any non-root destination equally.

The old code only worked "by accident" when the user was at the root level, because destination.source happened to equal defaultRemoteURL + defaultRootPath. The moment you navigate into any subfolder, regular or Team Folder, and drag-drop a folder there, the MKCOL goes to the wrong location (it creates the directory at the user root instead of the current folder).

The fix should apply universally to any non-root destination.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@solracsf solracsf added this to the Nextcloud 34 milestone Mar 29, 2026
@solracsf
solracsf requested review from a team and skjnldsv as code owners March 29, 2026 13:58
@solracsf solracsf added the 3. to review Waiting for reviews label Mar 29, 2026
@solracsf
solracsf requested review from nfebe and susnux and removed request for a team March 29, 2026 13:58
@solracsf
solracsf force-pushed the dragDropDirCreate branch from afb9a61 to 8373f2c Compare March 29, 2026 15:32
@susnux

This comment was marked as outdated.

@solracsf

This comment was marked as resolved.

@solracsf solracsf changed the title fix(filesDrop): drag-and-drop folder upload directories fix(filesDrop): drag-and-drop folder upload Mar 30, 2026

@susnux susnux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see this is not about not uploading in the "root" but its about different dav roots

@susnux

susnux commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

/backport to stable33

@susnux

susnux commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

/backport to stable32

@susnux

susnux commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

/backport to stable31

@cristianscheid cristianscheid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@susnux
susnux force-pushed the dragDropDirCreate branch from 8373f2c to 5a9fa36 Compare March 31, 2026 22:13
@susnux

susnux commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@susnux
susnux merged commit f6379da into master Mar 31, 2026
172 of 181 checks passed
@susnux
susnux deleted the dragDropDirCreate branch March 31, 2026 23:30
export async function createDirectoryIfNotExists(path: string) {
const davUrl = join(defaultRemoteURL, defaultRootPath)
export async function createDirectoryIfNotExists(path: string, destination?: IFolder) {
const davUrl = destination?.source ?? join(defaultRemoteURL, defaultRootPath)

@brlin-tw brlin-tw Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@susnux

Apologies for bumping the merged PR, however, note that this line seems to have introduced a regression where the destination.source variable isn't URL-encoded before being used in the DAV client.

Reproduce instructions:

  1. Create a folder which name started with the # symbol
  2. Enter the created folder
  3. Drag and drop to upload a folder into this folder.

Expected behavior:

Folder uploaded successfully.

Current behavior:

  • No folder creation MKCOL request sent
  • Folder content upload PUT requests failed with 404 error since the folder isn't created in the first place

Maybe related to nextcloud-libraries/nextcloud-upload#1964, but the issue creation date is earlier than this fix so I'm not sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This problem seems to be already filed as #62716.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will take a look

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for more than 7 days. As we do not monitor merged or closed pull requests, we are locking this pull request to prevent further comments from getting lost in the noise.
If you discovered any issues with this pull request, please open a new issue instead. In case you want to discuss this pull request or have further questions, please use our forum: https://help.nextcloud.com

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Drag&Drop folder upload not working

5 participants