Skip to content

Commit

Permalink
fix fetchParams func
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Jan 3, 2024
1 parent d9ae0e4 commit 79cdbbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions url/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestMergeUnsafePaths(t *testing.T) {
{"scanme.sh", "../../../etc/passwd", "/../../../etc/passwd"},
{"//scanme.sh", "/..%252F..%252F..%252F..%252F..%252F", "/..%252F..%252F..%252F..%252F..%252F"},
{"/?user=true", "/profile", "/profile?user=true"},
{"scanme.sh", "/?", "/?"},
}

for _, v := range testcase2 {
Expand Down
4 changes: 3 additions & 1 deletion url/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,15 @@ func (u *URL) fetchParams() {
return
} else {
encodedParams := u.Original[index+1:]
if encodedParams == "" {
return
}
u.Params.Decode(encodedParams)
u.Original = u.Original[:index]
}
u.Update()
}


// copy parsed data from src to dst this does not include fragment or params
func copy(dst *url.URL, src *url.URL) {
dst.Host = src.Host
Expand Down

0 comments on commit 79cdbbc

Please sign in to comment.