Skip to content
Snippets Groups Projects
Commit 8fb2baec authored by Andrew Dolgov's avatar Andrew Dolgov
Browse files

another hack for validation of URLs with invalid characters

parent a897c416
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,7 @@ class UrlHelper {
// extended filtering involves validation for safe ports and loopback
static function validate($url, $extended_filtering = false) {
$url = clean(rawurldecode($url));
$url = clean($url);
# fix protocol-relative URLs
if (strpos($url, "//") === 0)
......@@ -65,8 +65,10 @@ class UrlHelper {
return false;
if ($tokens['path']) {
// urlencode path, but respect "/" path delimiters
$tokens['path'] = implode("/", array_map("rawurlencode", explode("/", $tokens['path'])));
$tokens['path'] = implode("/",
array_map("rawurlencode",
array_map("rawurldecode",
explode("/", $tokens['path']))));
}
//convert IDNA hostname to punycode if possible
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment