]> Cypherpunks.ru repositories - gostls13.git/commit
path/filepath: don't drop .. elements when cleaning invalid Windows paths
authorDamien Neil <dneil@google.com>
Tue, 8 Aug 2023 21:07:08 +0000 (14:07 -0700)
committerDamien Neil <dneil@google.com>
Tue, 8 Aug 2023 21:48:12 +0000 (21:48 +0000)
commit6e43407931ee4acc204620a9fae59c7903164901
tree8d6adae172fbe971d7d0b22d05332e76ccc52c67
parentfe1daf2e439ec1d650ea1193f10f52525f83f8a7
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".

Fixes #61866

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>
src/path/filepath/path.go
src/path/filepath/path_test.go