Skip to content
Snippets Groups Projects
  • Russ Cox's avatar
    e5b08e6d
    io/fs: allow backslash in ValidPath, reject in os.DirFS.Open · e5b08e6d
    Russ Cox authored
    Rejecting backslash introduces problems with presenting
    underlying OS file systems that contain names with backslash.
    Rejecting backslash also does not Windows-proof the syntax,
    because colon can also be a path separator. And we are not
    going to reject colon from all names. So don't reject backslash
    either.
    
    There is a similar problem on Windows with names containing
    slashes, but those are more difficult (though not impossible)
    to create.
    
    Also document and enforce that paths must be UTF-8.
    
    Fixes #44166.
    
    Change-Id: Iac7a9a268025c1fd31010dbaf3f51e1660c7ae2a
    Reviewed-on: https://go-review.googlesource.com/c/go/+/290709
    
    
    TryBot-Result: Go Bot <gobot@golang.org>
    Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
    Trust: Russ Cox <rsc@golang.org>
    Run-TryBot: Russ Cox <rsc@golang.org>
    e5b08e6d
    History
    io/fs: allow backslash in ValidPath, reject in os.DirFS.Open
    Russ Cox authored
    Rejecting backslash introduces problems with presenting
    underlying OS file systems that contain names with backslash.
    Rejecting backslash also does not Windows-proof the syntax,
    because colon can also be a path separator. And we are not
    going to reject colon from all names. So don't reject backslash
    either.
    
    There is a similar problem on Windows with names containing
    slashes, but those are more difficult (though not impossible)
    to create.
    
    Also document and enforce that paths must be UTF-8.
    
    Fixes #44166.
    
    Change-Id: Iac7a9a268025c1fd31010dbaf3f51e1660c7ae2a
    Reviewed-on: https://go-review.googlesource.com/c/go/+/290709
    
    
    TryBot-Result: Go Bot <gobot@golang.org>
    Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
    Trust: Russ Cox <rsc@golang.org>
    Run-TryBot: Russ Cox <rsc@golang.org>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.