-
Notifications
You must be signed in to change notification settings - Fork 17.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
path/filepath: Clean doesn't remove trailing backslash from Windows volume name #27791
Comments
Some more testcases: https://paste.ofcode.org/KcUi8HKPrhLCcMmMET356T |
After some investigation I discovered that the problem is in |
I can confirm, that filepath.Clean does not remove trailing backslash from @QtRoS would you like to send a fix for this? https://golang.org/doc/contribute.html is how to contribute. Alex |
@alexbrainman yes, I will surely try to fix it soon! |
Change https://golang.org/cl/137055 mentions this issue: |
Change https://golang.org/cl/163077 mentions this issue: |
Change https://golang.org/cl/163078 mentions this issue: |
Revert CL 137055, which changed Clean("\\somepath\dir\") to return "\\somepath\dir" on Windows. It's not entirely clear this is correct, as this path is really "\\server\share\", and as such the trailing slash may be the path on that share, much like "C:\". In any case, the change broke existing code, so roll it back for now and rethink for 1.13. Updates #27791 Fixes #30307 Change-Id: I69200b1efe38bdb6d452b744582a2bfbb3acbcec Reviewed-on: https://go-review.googlesource.com/c/163077 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reopening because the CL was reverted. But see #30307, which argues that this suggested change is not correct in at least some cases. |
Revert CL 137055, which changed Clean("\\somepath\dir\") to return "\\somepath\dir" on Windows. It's not entirely clear this is correct, as this path is really "\\server\share\", and as such the trailing slash may be the path on that share, much like "C:\". In any case, the change broke existing code, so roll it back for now and rethink for 1.13. Updates golang#27791 Fixes golang#30307 Change-Id: I69200b1efe38bdb6d452b744582a2bfbb3acbcec Reviewed-on: https://go-review.googlesource.com/c/163077 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
…lean bug" Revert CL 137055, which changed Clean("\\somepath\dir\") to return "\\somepath\dir" on Windows. It's not entirely clear this is correct, as this path is really "\\server\share\", and as such the trailing slash may be the path on that share, much like "C:\". In any case, the change broke existing code, so roll it back for now and rethink for 1.13. Updates #27791 Updates #30307 Change-Id: I69200b1efe38bdb6d452b744582a2bfbb3acbcec Reviewed-on: https://go-review.googlesource.com/c/163077 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> (cherry picked from commit 153c0da) Reviewed-on: https://go-review.googlesource.com/c/163078 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?go 1.10.3 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Windows 7, Core I7, x64
What did you do?
What did you expect to see?
\\somepath\dir
(without trailing slash as per documentation)What did you see instead?
\\somepath\dir\
(with trailing shash)Seems that problem is in two Windows slashes at the beginning, all other cases work just fine.
The text was updated successfully, but these errors were encountered: