Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for character incompatibility corner case on Windows.
We generally rely on system calls rejecting invalid path names so that we can avoid checking every path for invalid characters, but backslashes on Windows can be problematic if synchronizing against a POSIX system where a directory at the same level as the invalid filename has a name that is the prefix (pre-'\' string) of the invalid filename. This commit adds an explicit check for this case with negligible overhead.
- Loading branch information
1 parent
52ebbe9
commit cca818e
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// +build !windows | ||
|
||
package sync | ||
|
||
func pathContainsInvalidCharacters(path string) bool { | ||
return false | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package sync | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
func pathContainsInvalidCharacters(path string) bool { | ||
return strings.Contains(path, "\\") | ||
} |