diff options
author | Christian Schneider | 2024-09-04 14:36:24 +0200 |
---|---|---|
committer | Christian Schneider | 2024-09-04 14:36:24 +0200 |
commit | f9a6d22c30938cb73ad2d79c22ce49f37b0fb966 (patch) | |
tree | 2ad2dcf7f75b120c3051cc2295c10882752a9501 | |
parent | c5ecb9054f8e5148bb777d9fb44d48c01a190838 (diff) | |
download | itools-f9a6d22c30938cb73ad2d79c22ce49f37b0fb966.tar.gz itools-f9a6d22c30938cb73ad2d79c22ce49f37b0fb966.tar.bz2 itools-f9a6d22c30938cb73ad2d79c22ce49f37b0fb966.zip |
Allow data urls and do not encode as it can break them
-rw-r--r-- | it_html.class | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index ec1e1ce..e9c1c67 100644 --- a/it_html.class +++ b/it_html.class @@ -506,7 +506,7 @@ static function U(...$args) if (it::match('javascript', $u['scheme'])) $u['scheme'] = ''; - $schemepart = $hostpart ? ($u['scheme'] ? $u['scheme'] . ":" : "") . "//$hostpart" : ($u['scheme'] == "mailto" ? $u['scheme'] . ":" : ""); + $schemepart = $hostpart ? ($u['scheme'] ? $u['scheme'] . ":" : "") . "//$hostpart" : ($u['scheme'] == "data" || $u['scheme'] == "mailto" ? $u['scheme'] . ":" : ""); # remove strings that will be interpreted as scheme from path if (!$schemepart && !$hostpart) @@ -515,7 +515,7 @@ static function U(...$args) # sanitize path and fragment $u['path'] = preg_replace('|\\\\|', '/', $u['path']); # turn \ to / foreach (['path', 'query', 'fragment'] as $key) - $u[$key] = preg_replace_callback('/[^-a-z0-9_.+!*(),:?@&=\/~$%#]|%(?![0-9a-f]{2})/i', function($m) { return rawurlencode($m[0]); }, $u[$key]); + $u[$key] = preg_replace_callback('/[^-a-z0-9_.+!*(),:?@&=\/~$%#]|%(?![0-9a-f]{2})/i', fn($m) => $u['scheme'] != 'data' ? rawurlencode($m[0]) : $m[0], $u[$key]); # convert empty http url path to / if (!$u['path'] && $hostpart && preg_match('/^(https?)?$/', $u['scheme'])) |