Skip to content

fix(transfer): accept colon object keys on Unix destinations - #350

Merged
cxymds merged 7 commits into
mainfrom
cursor/fix-unportable-object-keys-fce3
Aug 25, 2026
Merged

fix(transfer): accept colon object keys on Unix destinations#350
cxymds merged 7 commits into
mainfrom
cursor/fix-unportable-object-keys-fce3

Conversation

@loverustfs

@loverustfs loverustfs commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Related issue(s)

Fixes #338

Background

rc mirror and recursive rc object copy applied Windows filename rules to every object key, including on Linux. A single key containing : aborted enumeration, so buckets written by Grafana Loki could not be mirrored or recursively downloaded.

Root cause

Path normalization treated :, reserved device names, and trailing dots/spaces as globally illegal. Those rules are Windows filesystem constraints, not S3 key constraints, and they ran before any destination-specific mapping.

Solution

  • Add a shared ObjectKeyPolicy in rc-core.
  • Always reject traversal, absolute paths, backslashes, and control characters.
  • Apply Windows filename rules only when writing to a local filesystem that needs them: always on Windows, and on other platforms only with --portable-names.
  • Remote-to-remote copies keep the original key, including :.

This PR must be marked BREAKING because docs/reference/rc/cp.md and docs/reference/rc/mirror.md are protected CLI behavior contracts. The change is additive; no JSON schema or config schema_version bump applies.

Test status

  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace
  • Regression script: scripts/regression/object-key-safety.sh

New coverage includes Loki-style colon keys, Windows-portable rejection of colon keys in local path mapping, empty/dot-only key rejection, CLI --portable-names parsing, and help-contract updates.

Open in Web Open in Cursor 

cursoragent and others added 4 commits August 24, 2026 15:52
Stop applying Windows filename rules to every S3 key. Traversal and
control-character checks still always apply, while ':' and other
Windows-reserved names are enforced only on Windows local destinations
or when --portable-names is set. This unblocks Loki-style keys for
mirror and recursive download on Unix.

Co-authored-by: RustFS <hello@rustfs.com>
Reject colon keys under Windows-portable policy and empty or
dot-only relative keys. Mark the protected cp and mirror contracts
with BREAKING migration notes for the additive --portable-names flag.

Co-authored-by: RustFS <hello@rustfs.com>
The previous synchronize event ran before the PR body included
BREAKING. This empty commit re-runs CI against the updated description.

Co-authored-by: RustFS <hello@rustfs.com>
recursive_version_removal_paginates_and_deletes_markers hit a
connection-reset flake in the local HTTP mock. The previous two
commits on this branch passed Test (macos-latest).

Co-authored-by: RustFS <hello@rustfs.com>
@houseme
houseme requested review from cxymds and overtrue and removed request for cxymds August 25, 2026 02:36
@houseme
houseme marked this pull request as ready for review August 25, 2026 02:37
Comment thread crates/cli/src/commands/cp.rs
@cxymds
cxymds merged commit 9d91bde into main Aug 25, 2026
17 checks passed
@cxymds
cxymds deleted the cursor/fix-unportable-object-keys-fce3 branch August 25, 2026 06:24
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.

rc mirror / rc object copy --recursive reject every object key containing : — Windows naming rules applied unconditionally

3 participants