File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -406,9 +406,10 @@ func checkPathLength(pathName string) *probe.Error {
406
406
return probe .NewError (errors .New ("file name too long" ))
407
407
}
408
408
409
- // Disallow more than 1024 characters on windows, there
409
+ // Disallow more than 32,767 characters on windows, there
410
410
// 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 {
412
413
return probe .NewError (errors .New ("file name too long" ))
413
414
}
414
415
@@ -428,12 +429,14 @@ func checkPathLength(pathName string) *probe.Error {
428
429
case '\\' :
429
430
if runtime .GOOS == "windows" {
430
431
count = 0
432
+ } else {
433
+ count ++
431
434
}
432
435
default :
433
436
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" ))
437
440
}
438
441
} // Success.
439
442
return nil
You can’t perform that action at this time.
0 commit comments