Skip to content

refactor(upload): safer header handling and clearer chunk logic#2115

Open
joshtrichards wants to merge 2 commits into
nextcloud-libraries:mainfrom
joshtrichards:jtr/upload-polish
Open

refactor(upload): safer header handling and clearer chunk logic#2115
joshtrichards wants to merge 2 commits into
nextcloud-libraries:mainfrom
joshtrichards:jtr/upload-polish

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Jun 18, 2026

Copy link
Copy Markdown

Some polishing of the upload helpers to avoid mutating passed-in headers and improve readability:

  • normalize uploadData() options into explicit local variables / replace spread-defaults with explicit const locals in uploadData() for clarity and easier auditing
  • clone headers before mutating in uploadData() and initChunkWorkspace()
  • tidy getChunk() logic and variable naming
  • improve inline and doc comments

Notes:

  • I kept the blob creation behavior intact. It was tempting to remove the new Blob wrappers around file / file.slice() in getChunk(), but I did not want to risk a behavior change in case that normalization is relied on for browser compatibility or MIME-type handling.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI [sure; it suggested some comment tweaks]

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards marked this pull request as ready for review June 18, 2026 21:59
@joshtrichards joshtrichards changed the title refactor(upload): clean up upload helpers and chunk handling refactor(upload): safer header handling and clearer chunk logic Jun 18, 2026
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.

1 participant