-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed as not planned
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version)?
$ go version
Does this issue reproduce with the latest release?
alway Exist
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
func TestEncodedUrlPathEncode(t *testing.T) {
urlString := "http://www.xyz.com/!^test.jpg"
parsedUrl, _ := url.Parse(urlString)
rawUrl := parsedUrl.EscapedPath()
fmt.Println("encodedUrl:",rawUrl)
}
func TestEncodedUrlPathEncode(t *testing.T) {
urlString := "http://www.xyz.com/!test.jpg"
parsedUrl, _ := url.Parse(urlString)
rawUrl := parsedUrl.EscapedPath()
fmt.Println("encodedUrl:",rawUrl)
}
What did you expect to see?
for example
originUrl:https://github.com/!test.jpg
encodedUrl: https://github.com/!test.jpg --- result is expected
originUrl: https://github.com/!^test.jpg
encodedUrl: https://github.com/%21%5Etest.jpg
expected: https://github.com/!%5eds.jpg
What did you see instead?
func (u *URL) EscapedPath() string {
if u.RawPath != "" && validEncoded(u.RawPath, encodePath) {
p, err := unescape(u.RawPath, encodePath)
if err == nil && p == u.Path {
return u.RawPath
}
}
if u.Path == "*" {
return "*" // don't escape (Issue 11202)
}
return escape(u.Path, encodePath)
}
i found the code int sdk, "validEncoded" method treat the "!" as encoded, but in "escape" define "!" need encoed when mode is “encodePath”, where is judged in method "shouldEscape", logic conflict, so the result is not expected.
and i found other language do not encode "!" "(" ")" , such as python
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.