From fd891a5ef966610d4a6af9787bdc13799addce16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Can=20Bak=C4=B1r?= Date: Fri, 25 Aug 2023 09:15:28 +0300 Subject: [PATCH] Revert "allow w/ unsafe" This reverts commit b075bdfac486da4dcc96ee538da6ac5a9fe9ced5. --- url/url.go | 5 +---- url/url_test.go | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/url/url.go b/url/url.go index 6614ecf..bbc7784 100644 --- a/url/url.go +++ b/url/url.go @@ -238,10 +238,7 @@ func decodeUnicodeEscapes(inputURL string) string { // Parse and return URL func ParseURL(inputURL string, unsafe bool) (*URL, error) { - if unsafe { - inputURL = decodeUnicodeEscapes(inputURL) - } - + inputURL = decodeUnicodeEscapes(inputURL) u := &URL{ URL: &url.URL{}, Original: inputURL, diff --git a/url/url_test.go b/url/url_test.go index 79c9446..e128bf3 100644 --- a/url/url_test.go +++ b/url/url_test.go @@ -118,7 +118,7 @@ func TestParseRelativePath(t *testing.T) { } } -func TestUnicodeEscapeWithUnsafe(t *testing.T) { +func TestUnicodeEscape(t *testing.T) { testcases := []struct { input string expected string @@ -127,7 +127,7 @@ func TestUnicodeEscapeWithUnsafe(t *testing.T) { } for _, v := range testcases { - urlx, err := ParseURL(v.input, true) + urlx, err := Parse(v.input) require.Nilf(t, err, "got error for url %v", v.input) require.Equal(t, v.expected, urlx.String()) }