Skip to content

fix(dav): bulk upload part validation and path-based file reload - #62808

Draft
joshtrichards wants to merge 4 commits into
masterfrom
jtr/fix-bulkUpload-robustness
Draft

fix(dav): bulk upload part validation and path-based file reload#62808
joshtrichards wants to merge 4 commits into
masterfrom
jtr/fix-bulkUpload-robustness

Conversation

@joshtrichards

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Harden the DAV bulk-upload endpoint when processing multipart file parts.

  • Validate required X-File-Path and non-negative numeric Content-Length headers.
  • Preserve support for zero-byte files.
  • Reload uploaded files by their requested path after setting mtime, instead of resolving by file ID.
  • Ensure per-part error handling reports the captured path safely.
  • Add regression coverage for malformed headers and failed path reloads.

Why

getFirstNodeById() can return null and does not guarantee which accessible node is selected when a file is reachable through multiple mounts. Reloading by the uploaded path is deterministic and avoids dereferencing a nullable result.

Malformed multipart headers were also able to reach later upload handling code instead of being rejected during parsing.

Testing

  • Added parser tests for missing X-File-Path and invalid Content-Length values.
  • Added coverage that Content-Length: 0 remains accepted.
  • Added plugin coverage for a failed path-based reload and verified that getFirstNodeById() is not used.

TODO

Checklist

AI (if applicable)

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

Avoid a nullable/ambiguous node: In particular, `getFirstNodeById()` doesn't guarantee which node it'll return.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
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.

1 participant