diff options
author | 2022-05-02 14:05:18 +0100 | |
---|---|---|
committer | 2022-05-02 15:05:18 +0200 | |
commit | b56dae8120d43b9acd3d3ed4d40100ffab7b972a (patch) | |
tree | d55d30589d8a8499ed3d5eecba163abc9fa78c27 /vendor/github.com/tdewolff/parse/v2/util.go | |
parent | add extra indexes as a migration (#527) (diff) | |
download | gotosocial-b56dae8120d43b9acd3d3ed4d40100ffab7b972a.tar.xz |
[chore] Update all but bun libraries (#526)
* update all but bun libraries
Signed-off-by: kim <grufwub@gmail.com>
* remove my personal build script changes
Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/util.go')
-rw-r--r-- | vendor/github.com/tdewolff/parse/v2/util.go | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/util.go b/vendor/github.com/tdewolff/parse/v2/util.go index 07101f467..4174cb242 100644 --- a/vendor/github.com/tdewolff/parse/v2/util.go +++ b/vendor/github.com/tdewolff/parse/v2/util.go @@ -397,8 +397,9 @@ var URLEncodingTable = [256]bool{ } // DataURIEncodingTable is a charmap for which characters need escaping in the Data URI encoding scheme -// Escape only non-printable characters, unicode and %, #, &. IE11 additionally requires encoding of -// \, [, ], ", <, >, `, {, }, |, ^ which is not required by Chrome, Firefox, Opera, Edge, Safari, Yandex +// Escape only non-printable characters, unicode and %, #, &. +// IE11 additionally requires encoding of \, [, ], ", <, >, `, {, }, |, ^ which is not required by Chrome, Firefox, Opera, Edge, Safari, Yandex +// To pass the HTML validator, restricted URL characters must be escaped: non-printable characters, space, <, >, #, %, " var DataURIEncodingTable = [256]bool{ // ASCII true, true, true, true, true, true, true, true, @@ -406,7 +407,7 @@ var DataURIEncodingTable = [256]bool{ true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, - false, false, true, true, false, true, true, false, // ", #, %, & + true, false, true, true, false, true, true, false, // space, ", #, %, & false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, true, false, // <, > @@ -448,15 +449,11 @@ func EncodeURL(b []byte, table [256]bool) []byte { for i := 0; i < len(b); i++ { c := b[i] if table[c] { - if c == ' ' { - b[i] = '+' - } else { - b = append(b, 0, 0) - copy(b[i+3:], b[i+1:]) - b[i+0] = '%' - b[i+1] = "0123456789ABCDEF"[c>>4] - b[i+2] = "0123456789ABCDEF"[c&15] - } + b = append(b, 0, 0) + copy(b[i+3:], b[i+1:]) + b[i+0] = '%' + b[i+1] = "0123456789ABCDEF"[c>>4] + b[i+2] = "0123456789ABCDEF"[c&15] } } return b |