Skip to content

fix(libsync): add NEXTCLOUD_BULK_UPLOAD env override to force-disable bulk upload#10300

Open
mosandlt wants to merge 2 commits into
nextcloud:masterfrom
mosandlt:fix/bulkupload-env-override
Open

fix(libsync): add NEXTCLOUD_BULK_UPLOAD env override to force-disable bulk upload#10300
mosandlt wants to merge 2 commits into
nextcloud:masterfrom
mosandlt:fix/bulkupload-env-override

Conversation

@mosandlt

@mosandlt mosandlt commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an OWNCLOUD_BULK_UPLOAD environment variable override to Capabilities::bulkUpload(), mirroring the existing OWNCLOUD_CHUNKING_NG pattern in the same file (src/libsync/capabilities.cpp).

Problem

Bulk upload (POST .../dav/bulk) is enabled automatically whenever the server advertises the dav.bulkupload capability, with no client-side way to opt out if that endpoint is broken or blocked somewhere in the network path (reverse proxy, WAF, CDN, etc).

Observed against a self-hosted Nextcloud instance where every single bulk-upload POST failed immediately with UnknownNetworkError, while regular per-file uploads (PropagateUploadFileNG) succeeded without issue. Because the failure is deterministic and the in-memory per-file bulk-upload blacklist does not survive across the --max-sync-retries internal restarts (let alone separate nextcloudcmd invocations from a cron/systemd timer), affected files never converge — the sync stays permanently red for every file it decides to bulk-upload, run after run, with no recovery path short of patching the client.

Fix

OWNCLOUD_BULK_UPLOAD=0 forces bulk upload off regardless of server capabilities (falls back to the normal single-file upload path). OWNCLOUD_BULK_UPLOAD=1 forces it on. Unset preserves current behavior exactly (server capability decides).

Verified locally: rebuilding nextcloudcmd/libnextcloudsync with this change and setting OWNCLOUD_BULK_UPLOAD=0 took a sync from a reproducible ~630-file failure batch (100% of that sync's bulk-upload attempts failing with UnknownNetworkError, identical set of files failing across 3 consecutive runs) down to a clean run with zero bulk-related errors, using the regular upload path instead.

Testing

  • Local dpkg-buildpackage build against Debian 12 (bookworm) package 3.7.3-1+deb12u2
  • Confirmed OWNCLOUD_BULK_UPLOAD=0 / =1 / unset all behave as expected against a real server
  • No existing tests cover Capabilities::bulkUpload(); behavior for the unset case is unchanged (same expression as before, now reached only after the two new early-return checks)

@mosandlt
mosandlt force-pushed the fix/bulkupload-env-override branch from 72ea360 to a061b60 Compare July 4, 2026 19:00

@mgallien mgallien left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Comment thread src/libsync/capabilities.cpp Outdated
@mgallien

Copy link
Copy Markdown
Collaborator

@mosandlt gentle reminder
you might want to finish the PR such that we can merge it

mosandlt added a commit to mosandlt/desktop that referenced this pull request Jul 16, 2026
Per review feedback from @mgallien on PR nextcloud#10300 - new env vars should
use the NEXTCLOUD_ prefix, not the legacy OWNCLOUD_ one (kept only for
the pre-existing OWNCLOUD_CHUNKING_NG override).

Signed-off-by: mosandlt <10558666+mosandlt@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-sonnet-5
@mosandlt

Copy link
Copy Markdown
Contributor Author

Renamed to NEXTCLOUD_BULK_UPLOAD per your suggestion, thanks!

@nilsding nilsding changed the title fix(libsync): add OWNCLOUD_BULK_UPLOAD env override to force-disable bulk upload fix(libsync): add NEXTCLOUD_BULK_UPLOAD env override to force-disable bulk upload Jul 16, 2026
mosandlt added 2 commits July 16, 2026 11:20
…bulk upload

Mirrors the existing OWNCLOUD_CHUNKING_NG override pattern in the same
file. Bulk upload (POST .../dav/bulk) is enabled automatically whenever
the server advertises the dav.bulkupload capability, with no
client-side way to opt out if that endpoint is broken or blocked
somewhere in the network path (reverse proxy, WAF, etc).

Observed against a self-hosted Nextcloud instance where every single
bulk-upload POST failed immediately with UnknownNetworkError, while
regular per-file uploads succeeded without issue. Because the failure
is deterministic and the client re-attempts bulk upload from scratch
on every sync invocation (the in-memory per-file blacklist does not
survive across the max-sync-retries restarts, let alone separate
nextcloudcmd invocations), affected files never converge and the sync
stays permanently red for that server.

Setting OWNCLOUD_BULK_UPLOAD=0 lets an operator route around a broken
bulk endpoint without needing a custom build, matching the escape hatch
already available for chunking via OWNCLOUD_CHUNKING_NG.

Signed-off-by: mosandlt <10558666+mosandlt@users.noreply.github.com>
Per review feedback from @mgallien on PR nextcloud#10300 - new env vars should
use the NEXTCLOUD_ prefix, not the legacy OWNCLOUD_ one (kept only for
the pre-existing OWNCLOUD_CHUNKING_NG override).

Signed-off-by: mosandlt <10558666+mosandlt@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-sonnet-5
@nilsding
nilsding force-pushed the fix/bulkupload-env-override branch from 24f1788 to baf6cbc Compare July 16, 2026 09:20
@nilsding
nilsding requested a review from claucambra as a code owner July 16, 2026 09:20
@github-actions

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10300.zip

Digest: sha256:f1c72ae991d1ef8a845e9322afb4f76ae799967e6325ad82275d7d0ce345d1cf

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

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.

4 participants