Skip to content

Commit 24cbe25

Browse files
committed
Fix over-eager windows path restrictions
Current regexp will match anything starting with forbidden patterns. This changes properly reduces that to paths that exactly match the forbidden patterns. Signed-off-by: apostasie <[email protected]>
1 parent 427f1cb commit 24cbe25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/store/filestore_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
// See https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file
2525
// https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names
2626
var (
27-
disallowedKeywords = regexp.MustCompile(`(?i)^(con|prn|nul|aux|com[1-9¹²³]|lpt[1-9¹²³])([.].*)?`)
27+
disallowedKeywords = regexp.MustCompile(`(?i)^(con|prn|nul|aux|com[1-9¹²³]|lpt[1-9¹²³])([.].*)?$`)
2828
reservedCharacters = regexp.MustCompile(`[\x{0}-\x{1f}<>:"/\\|?*]`)
2929
)
3030

0 commit comments

Comments
 (0)