diff options
Diffstat (limited to 'it_html.class')
-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'])) |