Skip to content

[_]: feat/fix-put-handler#598

Open
larryrider wants to merge 10 commits into
mainfrom
feat/fix-put-handler
Open

[_]: feat/fix-put-handler#598
larryrider wants to merge 10 commits into
mainfrom
feat/fix-put-handler

Conversation

@larryrider

@larryrider larryrider commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Improvements & Fixes

  1. Increase file size limit from 40 GB to 100 GB
  • Raised the hard cap for file uploads from 40 GB to 100 GB in NetworkFacade
  • Updated the error message and corresponding tests
  1. Proper WebDAV 413 response for oversized files (PUT.handler.ts)
  • Added a try-catch around networkFacade.uploadFile() to catch "file is too big" errors
  • Returns a standards-compliant 413 Payload Too Large response with an XML body, rather than letting the error propagate as a generic 500 Internal Server Error
  • Properly cleans up the buffer stream and destroys the request on error
  1. Fix error middleware content type and resource cleanup (errors.middleware.ts)
  • Added Content-Type: application/xml; charset="utf-8" header to error responses so clients receive properly formatted XML
  • Added req.destroy() to ensure the request socket is fully closed after an error response
  1. Test updates
  • Updated test descriptions and assertions to reflect the new 100 GB limit
  • Bumped test file sizes from 41 GB to 101 GB
    • Atomic credentials save:
  • getAuthDetails() no longer writes credentials to disk on every invocation.
  • saveUser() (disk write + cache update) is only called when credentials actually change (token refreshed or workspace credentials changed). When nothing changes, only the in-memory cache is refreshed to extend the TTL. This eliminates the race condition where concurrent requests reading the file while another writes to it caused intermittent Missing credentials, please login first errors in WebDAV.
  • saveUser() now uses atomic writes: It writes to a .tmp file then fs.rename(), instead of writing directly to the credentials file. This prevents concurrent readers from seeing a partially written file.

@larryrider larryrider requested a review from AlexisMora June 11, 2026 16:17
@larryrider larryrider self-assigned this Jun 11, 2026
@larryrider larryrider changed the title Feat/fix put handler [_]: feat/fix-put-handler Jun 11, 2026
Comment thread src/webdav/handlers/PUT.handler.ts
Comment thread src/webdav/handlers/PUT.handler.ts Outdated
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
75.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

2 participants