Conversation
… copy
Copying a directory to a FAT/exFAT/vFAT destination failed outright as
soon as any nested entry's name contained a character those drivers
reject (" * / : < > ? \ | or a control character), discarding
everything already staged for the transfer even after hundreds of
megabytes had been written. Pasting a single file with such a name
failed the same way.
Mirror GNOME Files: when the destination reports a FAT-family
filesystem type (checked once per transfer against the parsed mount
table, not per file), replace rejected characters with '_' and trim
trailing dots/spaces the drivers would strip anyway. Sibling names
that collapse to the same result after sanitizing get a numbered
suffix instead of one silently overwriting the other. Applies to the
top-level paste target and every nested copy path (recursive copy,
move's WouldRecurse fallback, replace, and merge).
Closes lgse#1123
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.
Description
Copying a directory onto a FAT/exFAT/vFAT destination (a USB stick, most commonly) failed outright with "Invalid filename" as soon as any nested entry's name contained a character those drivers reject (
" * / : < > ? \ |, or a control character) — and since the transfer stages into a temporary sibling directory first, the whole staged copy was discarded on that one failure, even after a large amount had already been written. Pasting a single file with such a name failed the same way.Mirrors GNOME Files' behavior: when the destination reports a FAT-family filesystem type (checked once per transfer against the parsed mount table, not per file), rejected characters are replaced with
_and trailing dots/spaces are trimmed (the drivers strip these anyway). Sibling names that collapse to the same result after sanitizing get a numbered suffix (name (1).ext) instead of one silently overwriting the other. This applies to the top-level paste target and every nested copy path: the recursive copy itself, move's cross-filesystemWouldRecursefallback, replace, and merge.Non-FAT destinations are completely unaffected — verified with a dedicated regression test.
Visual evidence
N/A — this only changes filename handling during file transfers; there is no UI-visible change.
How to test
mkdir demo && touch 'demo/a?b:c.txt' demo/ok.txt.truncate -s 256M fat.img && mkfs.exfat fat.img && udisksctl loop-setup -f fat.img.demoand paste it onto the mounted volume.Expected result: the folder is copied in full;
a?b:c.txtlands asa_b_c.txtinstead of the whole transfer failing and being discarded. Pasting a single file with an invalid name onto the same volume also succeeds, sanitized the same way.Local validation note: this machine has no docker/podman set up, so the pinned
./scripts/quality.shcontainer runner wasn't available — used plain hostcargo fmt --all --check/cargo clippy --all-targets --all-features -- -D warningsinstead (both clean), plus./scripts/test-headless.pyfor the fulladapters::local_operations::andadapters::volume::suites (all passing; two pre-existing, unrelated archive-compression test failures were confirmed present on unmodifiedmaintoo, viagit stash, before ruling them out as caused by this change).Related issue
Closes #1123