Thanks to visit codestin.com
Credit goes to github.com

Skip to content

copyurl: honor --size-only for existing destinations - #9896

Open
git-jxj wants to merge 1 commit into
rclone:masterfrom
git-jxj:fix-copyurl-size-only
Open

copyurl: honor --size-only for existing destinations#9896
git-jxj wants to merge 1 commit into
rclone:masterfrom
git-jxj:fix-copyurl-size-only

Conversation

@git-jxj

@git-jxj git-jxj commented Sep 10, 2026

Copy link
Copy Markdown

What does this change do?

Make copyurl --size-only skip an existing destination when its size matches the HTTP response's known Content-Length. With an 8-byte destination containing original and an 8-byte response containing replaced, the destination is currently overwritten despite --size-only; this change preserves it and reports 0 transferred bytes.

The existing GET request still obtains the response headers and filename; the matching body is not passed to the upload path. Unknown lengths still copy normally, and --no-clobber retains precedence. The help text documents this behavior.

Validation:

  • A real HTTP server plus the local backend reproduces the overwrite before the fix. Regression coverage checks matching/different/unknown sizes, missing destinations, and --no-clobber precedence.
  • Built both upstream and fixed CLI binaries and ran the same HTTP reproduction: before, 8 bytes transferred and content overwritten; after, 0 bytes transferred and content preserved.
  • go build and go test ./fs/operations ./cmd/copyurl -count=1 passed.
  • Full make quicktest passed (180 packages, no test filters). Ran as an unprivileged user with a matching CLI on PATH; only the FTP test executable used a loopback network namespace because its passive port range overlaps this host's Kubernetes NodePorts. No test source or host firewall changes were required.
  • golangci-lint run ./fs/operations/... ./cmd/copyurl/...: 0 issues.

Linked issue

Fixes #9892

For new or changed backends

Not applicable.

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • (Backend changes only) test_all passes for this backend.
  • This Pull Request is ready for review.

AI tools assisted implementation, review, and the local executions described above. The account owner's separate personal review/ownership attestation is left unchecked.

@git-jxj
git-jxj requested review from ncw and nielash as code owners September 10, 2026 02:32
@git-jxj

git-jxj commented Sep 11, 2026

Copy link
Copy Markdown
Author

Could a maintainer rerun the failed linux_386 job in build 34429883384 for current head 0395d79fc4cf? The failure is the unchanged lib/pacer TestGoogleDrivePacer timing assertion (expected two delayed calls, got zero); cmd/copyurl and fs/operations passed in that same job. The PR and unmodified base each passed 1,000 local GOARCH=386 CGO_ENABLED=0 go test ./lib/pacer -run '^TestGoogleDrivePacer$' -count=1000 repetitions. The PR does not change lib/pacer or its dependencies. A rerun attempt was rejected with Must have admin rights to Repository, so I cannot confirm the remote retry from this account.

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.

copyurl should respect --size-only as much as possible

1 participant