path: add more examples for path.Clean
Clarify that the function path.Clean only normalises paths and does not protect against directory-traversal attacks. Change-Id: I66f1267ac15900ac0cb6011ace0c79aabaebc68b GitHub-Last-Rev: d669e1edf6221e7c8e0a9aa7bf46493c8ea85ba0 GitHub-Pull-Request: golang/go#74397 Reviewed-on: https://go-review.googlesource.com/c/go/+/684376 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Sean Liao <sean@liao.dev> Auto-Submit: Sean Liao <sean@liao.dev>
This commit is contained in:
committed by
Gopher Robot
parent
eec40aae45
commit
a572d571fa
@@ -25,6 +25,8 @@ func ExampleClean() {
|
||||
"a//c",
|
||||
"a/c/.",
|
||||
"a/c/b/..",
|
||||
"../a/c",
|
||||
"../a/b/../././/c",
|
||||
"/../a/c",
|
||||
"/../a/b/../././/c",
|
||||
"",
|
||||
@@ -39,6 +41,8 @@ func ExampleClean() {
|
||||
// Clean("a//c") = "a/c"
|
||||
// Clean("a/c/.") = "a/c"
|
||||
// Clean("a/c/b/..") = "a/c"
|
||||
// Clean("../a/c") = "../a/c"
|
||||
// Clean("../a/b/../././/c") = "../a/c"
|
||||
// Clean("/../a/c") = "/a/c"
|
||||
// Clean("/../a/b/../././/c") = "/a/c"
|
||||
// Clean("") = "."
|
||||
|
||||
Reference in New Issue
Block a user