make it more explicit that caret/decaret are for encoding tags into URL paths

This commit is contained in:
Shish
2020-01-30 21:50:30 +00:00
parent fb80509be9
commit da42b19d6b
8 changed files with 70 additions and 73 deletions

View File

@@ -449,32 +449,9 @@ function int_escape(?string $input): int
*/
function url_escape(?string $input): string
{
/*
Shish: I have a feeling that these three lines are important, possibly for searching for tags with slashes in them like fate/stay_night
green-ponies: indeed~
$input = str_replace('^', '^^', $input);
$input = str_replace('/', '^s', $input);
$input = str_replace('\\', '^b', $input);
/* The function idn_to_ascii is used to support Unicode domains / URLs as well.
See here for more: http://php.net/manual/en/function.filter-var.php
However, it is only supported by PHP version 5.3 and up
if (function_exists('idn_to_ascii')) {
return filter_var(idn_to_ascii($input), FILTER_SANITIZE_URL);
} else {
return filter_var($input, FILTER_SANITIZE_URL);
}
*/
if (is_null($input)) {
return "";
}
$input = str_replace('^', '^^', $input);
$input = str_replace('/', '^s', $input);
$input = str_replace('\\', '^b', $input);
$input = str_replace('?', '^q', $input);
$input = str_replace('&', '^a', $input);
$input = rawurlencode($input);
return $input;
}