Merge pull request #4676 from annando/clean-url

Handle URL with unicode characters
This commit is contained in:
Hypolite Petovan 2018-03-24 15:31:07 -04:00 committed by GitHub
commit 7acb4b0434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,6 +79,18 @@ class Network
$a = get_app();
$parts = parse_url($url);
$path_parts = explode('/', $parts['path']);
foreach ($path_parts as $part) {
if (strlen($part) <> mb_strlen($part)) {
$parts2[] = rawurlencode($part);
} else {
$parts2[] = $part;
}
}
$parts['path'] = implode('/', $parts2);
$url = self::unparseURL($parts);
if (self::isUrlBlocked($url)) {
logger('domain of ' . $url . ' is blocked', LOGGER_DATA);
return $ret;