Pārlūkot izejas kodu

Fix windows rxReservedNames

This regex is currently matching volumes that include a
reserved word (ex. test-aux-volume)

Signed-off-by: Robert Shade <robert.shade@gmail.com>
Robert Shade 3 gadi atpakaļ
vecāks
revīzija
502b35c8f6

+ 1 - 1
volume/mounts/windows_parser.go

@@ -47,7 +47,7 @@ const (
 	rxName = `[^\\/:*?"<>|\r\n]+`
 
 	// RXReservedNames are reserved names not possible on Windows
-	rxReservedNames = `(con)|(prn)|(nul)|(aux)|(com[1-9])|(lpt[1-9])`
+	rxReservedNames = `(con|prn|nul|aux|com[1-9]|lpt[1-9])`
 
 	// rxPipe is a named path pipe (starts with `\\.\pipe\`, possibly with / instead of \)
 	rxPipe = `[/\\]{2}.[/\\]pipe[/\\][^:*?"<>|\r\n]+`

+ 1 - 0
volume/mounts/windows_parser_test.go

@@ -22,6 +22,7 @@ func TestWindowsParseMountRaw(t *testing.T) {
 		`c:\program files:d:\s p a c e i n h o s t d i r`,
 		`0123456789name:d:`,
 		`MiXeDcAsEnAmE:d:`,
+		`test-aux-volume:d:`, // includes reserved word, but is not one itself
 		`name:D:`,
 		`name:D::rW`,
 		`name:D::RW`,