mirror of
https://github.com/rclone/rclone.git
synced 2025-08-09 05:54:43 +02:00
lib/file: fix MkdirAll after go1.21.4 stdlib update
In ths security related issue the go1.21.4 stdlib changed the parsing of volume names on Windows. https://github.com/golang/go/issues/63713 This had the consequences of breaking the MkdirAll tests which were looking for specific error messages which changed and using invalid paths. In particular under go1.21.3: filepath.VolumeName(`\\?\C:`) == `\\?\C:` But under go1.21.4 it is: filepath.VolumeName(`\\?\C:`) == `\\?` The path `\\?\C:` isn't actually a valid Windows path. I reported this as a FYI bug upstream - I'm not expecting it to be fixed. See: https://github.com/golang/go/issues/64101
This commit is contained in:
@ -53,7 +53,7 @@ func MkdirAll(path string, perm os.FileMode) error {
|
||||
j--
|
||||
}
|
||||
if j > 1 {
|
||||
if path[:j-1] != `\\?\UNC` {
|
||||
if path[:j-1] != `\\?\UNC` && path[:j-1] != `\\?` {
|
||||
// Create parent.
|
||||
err = MkdirAll(path[:j-1], perm)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user