]> git.mxchange.org Git - friendica.git/commitdiff
Handle URL with unicode characters
authorMichael <heluecht@pirati.ca>
Fri, 23 Mar 2018 18:41:59 +0000 (18:41 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 23 Mar 2018 18:41:59 +0000 (18:41 +0000)
src/Util/Network.php

index d25b799242e052bc4b3406c2b873bca97a166ee8..bbdc51fbbb535f2e1adef957c8dbeda77d5adae4 100644 (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;