From 24cbe2524cb304ce02fc7d9742064100937dea4c Mon Sep 17 00:00:00 2001 From: apostasie Date: Tue, 15 Oct 2024 18:27:27 -0700 Subject: [PATCH] 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 --- pkg/store/filestore_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/store/filestore_windows.go b/pkg/store/filestore_windows.go index 9fbfe3e575a..75b18eb42e4 100644 --- a/pkg/store/filestore_windows.go +++ b/pkg/store/filestore_windows.go @@ -24,7 +24,7 @@ import ( // See https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file // https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names var ( - disallowedKeywords = regexp.MustCompile(`(?i)^(con|prn|nul|aux|com[1-9¹²³]|lpt[1-9¹²³])([.].*)?`) + disallowedKeywords = regexp.MustCompile(`(?i)^(con|prn|nul|aux|com[1-9¹²³]|lpt[1-9¹²³])([.].*)?$`) reservedCharacters = regexp.MustCompile(`[\x{0}-\x{1f}<>:"/\\|?*]`) )