Skip to content

Commit 33f6e68

Browse files
committed
Resolve review comments
1 parent 77eb169 commit 33f6e68

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: cmd/client-fs.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,10 @@ func checkPathLength(pathName string) *probe.Error {
406406
return probe.NewError(errors.New("file name too long"))
407407
}
408408

409-
// Disallow more than 1024 characters on windows, there
409+
// Disallow more than 32,767 characters on windows, there
410410
// are no known name_max limits on Windows.
411-
if runtime.GOOS == "windows" && len(pathName) > 1024 {
411+
// Refer: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
412+
if runtime.GOOS == "windows" && len(pathName) > 32767 {
412413
return probe.NewError(errors.New("file name too long"))
413414
}
414415

@@ -428,12 +429,14 @@ func checkPathLength(pathName string) *probe.Error {
428429
case '\\':
429430
if runtime.GOOS == "windows" {
430431
count = 0
432+
} else {
433+
count++
431434
}
432435
default:
433436
count++
434-
if count > 255 {
435-
return probe.NewError(errors.New("file name too long"))
436-
}
437+
}
438+
if count > 255 {
439+
return probe.NewError(errors.New("file name too long"))
437440
}
438441
} // Success.
439442
return nil

0 commit comments

Comments
 (0)