Repository navigation
lib/fs: Be more clear about invalid file names (ref #7010) - #7011
Merged
Merged
Conversation
Add specific errors for the failures, resulting in this rather than just the generic "invalid filename": [MRIW7] 08:50:50 INFO: Puller (folder default, item "NUL"): syncing: filename is invalid: name is reserved [MRIW7] 08:50:50 INFO: Puller (folder default, item "fail."): syncing: filename is invalid: name ends with space or period [MRIW7] 08:50:50 INFO: Puller (folder default, item "sup:yo"): syncing: filename is invalid: name contains reserved character [MRIW7] 08:50:50 INFO: default: Failed to sync 3 items
| var ( | ||
| errInvalidSpacePeriod = errors.New("name ends with space or period") | ||
| errInvalidReservedName = errors.New("name is reserved") | ||
| errInvalidReservedChar = errors.New("name contains reserved character") |
Member
There was a problem hiding this comment.
I guess the use of word reserved is a bit vague. I'd say name contains charaters not permitted on Windows, or file name is not permitted on windows or something.
Member
Author
There was a problem hiding this comment.
I refactored the errors a bit to be more clear, un-exported the things as they're not used outside of lib/fs currently
Member
Author
There was a problem hiding this comment.
Exact wording is a bit difficult because the "name" is actually a "path component" but then it gets very technical
AudriusButkevicius
approved these changes
Sep 28, 2020
calmh
added a commit
to calmh/syncthing
that referenced
this pull request
Sep 29, 2020
* main: lib/fs: Add COM0 and LPT0 to invalid Windows file names (ref syncthing#7008) (syncthing#7013) lib/fs: Be even more strict about Windows names (ref syncthing#7008) (syncthing#7012) lib/fs: Be more clear about invalid file names (ref syncthing#7010) (syncthing#7011) lib/model: Disallow reserved names, and names ending with period on Windows (fixes syncthing#7008) (syncthing#7010) lib/model, lib/scanner: Prevent races aborting scans (fixes syncthing#6994) (syncthing#6997) lib/fs: Use file clone ioctl wrappers and types from golang.org/x/sys/unix (syncthing#7000) Update config.yml gui, man, authors: Update docs, translations, and contributors
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Add specific errors for the failures, resulting in this rather than just
the generic "invalid filename":