]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.21] path/filepath: don't drop .. elements when cleaning invalid...
authorDamien Neil <dneil@google.com>
Tue, 8 Aug 2023 21:07:08 +0000 (14:07 -0700)
committerCarlos Amedee <carlos@golang.org>
Wed, 23 Aug 2023 17:53:26 +0000 (17:53 +0000)
commit45b98bfb793923c539f9a959c3047d2e5fe2ebf0
treea0b5798c077c0699cf78fea3085daf2a009230ab
parentbac083a5847a53bb726f65d6e9c2aeb54066bcf0
[release-branch.go1.21] path/filepath: don't drop .. elements when cleaning invalid Windows paths

Fix a bug where Clean could improperly drop .. elements from a
path on Windows, when the path contains elements containing a ':'.

For example, Clean("a/../b:/../../c") now correctly returns "..\c"
rather than "c".

For #61866.
Fixes #61868.

Change-Id: I97b0238953c183b2ce19ca89c14f26700008ea72
Reviewed-on: https://go-review.googlesource.com/c/go/+/517216
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
(cherry picked from commit 6e43407931ee4acc204620a9fae59c7903164901)
Reviewed-on: https://go-review.googlesource.com/c/go/+/519655
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
src/path/filepath/path.go
src/path/filepath/path_test.go