Skip to content

fix(uploader): encode the root of the batch upload WebDAV client - #2236

Open
solracsf wants to merge 1 commit into
nextcloud-libraries:mainfrom
solracsf:fix/batch-upload-encode-root
Open

solracsf wants to merge 1 commit into
nextcloud-libraries:mainfrom
solracsf:fix/batch-upload-encode-root

Conversation

@solracsf

@solracsf solracsf commented Oct 22, 2026 •

Copy link
Copy Markdown

Fixes #1964
Fixes nextcloud/server#62716

batchUpload() built its WebDAV client from the decoded root, so a # or ? in the destination path was read as a URL fragment or query. The MKCOL of a folder upload went to a truncated URL (.../files/admin#test/picked/ hit .../files/admin, a 405) and the file uploads then failed with 404. upload() already encodes its URL; the client is now built from the encoded root in the same way. The Upload objects, events and logs keep the decoded values.

Tests added in __tests__/uploader.spec.ts assert the full MKCOL and PUT URLs for #, ?, %, spaces, non-ASCII, nested folders and a public share root. They fail on the previous code and pass now. vitest run passes. Also checked against a throwaway local HTTP server with the real fetch and WebDAV client. npm run lint does not run locally on the current main (ESLint 10 vs the .eslintrc.json config), so lint was not run.

The same problem exists on the server for drag and drop, fixed in nextcloud/server#65789.

A `#` or `?` in the destination was taken as URL fragment or query, so
the MKCOL of folder uploads targeted a truncated URL and the following
file uploads failed. Build the client from the encoded root, like
`upload()` already does, and keep the decoded values for uploads and
events.

Fixes nextcloud-libraries#1964

Assisted-by: ClaudeCode:claude-sonnet-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: Codex:gpt-5.6
Assisted-by: Grok:grok-4.6
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf
solracsf force-pushed the fix/batch-upload-encode-root branch from 32dc226 to 4422f52 Compare October 22, 2026 14:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: uploading a folder into a folder, wich name starts with # fails using any browser MKCOL for batch upload does not work with special characters

1 participant