Skip to content

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

Merged
larryrider merged 15 commits into
mainfrom
feat/fix-put-handler
Jun 15, 2026
Merged

[_]: feat/fix-put-handler#598
larryrider merged 15 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 the user's tier limit
  • Raised the hard cap for file uploads from 40 GB to the user's tier limit in NetworkFacade
  • Updated the error message and corresponding tests
  • Added 10GB default size limit (although it is limited via backend as well)
  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 file limits
  • Bumped default test file sizes from 41 GB to 11 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
@larryrider larryrider requested a review from xabg2 June 15, 2026 09:21
Comment thread src/utils/upload.utils.ts
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@larryrider larryrider merged commit d806c9d into main Jun 15, 2026
8 of 9 checks passed
@larryrider larryrider deleted the feat/fix-put-handler branch June 15, 2026 09:59
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.

3 participants