Uploads hardening#6183
Open
mahibi wants to merge 4 commits into
Open
Conversation
…oad filecache bug Files sent as chat attachments never appeared in the conversation. Investigation showed the chunked upload MOVE returned HTTP 201 but a subsequent HEAD on the assembled file returned 404 - Nextcloud's server was not registering the file in oc_filecache on assembly. The OCS sharing API uses the filecache, so it also returned 404 'Wrong path, file/folder does not exist' despite the file existing on disk. Raise the chunked upload threshold from 1 MB to 20 MB so that typical phone photos go through direct PUT upload, which correctly updates the filecache. Chunked upload is still used for files over 20 MB. Additional fixes: - ChunkedFileUploader: build a fresh OkHttpClient without OCS-APIRequest and Accept: application/json headers, which were causing sabre/dav to return JSON 200 instead of XML 207 for PROPFIND, breaking dav4jvm. PROPFIND failures now fall back gracefully to uploading all chunks fresh. - FileUploader: fix createRequestBody() to use readBytes() instead of available(), which returns 0 for content:// URIs. - ShareOperationWorker: retry share creation up to 4 times with 2s delay on 404, as a safety net for large files using chunked upload. Signed-off-by: IIMacGyverII <macgyverjunk@yahoo.com> AI-assistant: Copilot 0.45.1 (Claude Sonnet 4.6)
Apply OCS-specific headers only for OCS endpoints in the global headers interceptor to avoid affecting DAV requests. Switch chunked and normal uploaders back to okHttpClient.newBuilder() so they inherit shared client config while keeping upload-specific redirect/protocol/auth settings. AI-assistant: Copilot 1.8.2-243 (GPT-5-Codex) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Refresh the chat immediately after upload/share completion and retry message fetches briefly when the server still returns 304. Also retry media previews on transient 5xx server errors so newly uploaded images are less likely to stay stuck on a placeholder. AI-assistant: Copilot 1.8.2-243 (GPT-5-Codex) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
this is done because for the normal upload there is no upload progress for now. Once there is an upload progress shown also for the normal uploads, it's fine to increase the threshold again Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
4d76ea3 to
a020414
Compare
This was referenced May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
branched off from #6152 (thanks for the initial commit to @IIMacGyverII 👍 )
This PR improves attachment upload reliability across both normal and chunked uploads and makes post-upload chat updates more reliable.
What changed
Why
Uploading attachments could fail or appear delayed in a few different ways:
This change makes the whole upload flow more tolerant to these timing-related backend races.
User impact
🏁 Checklist
/backport to stable-xx.x