mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-16 06:25:57 +00:00
rewrite_relative_url: cleanup resulting url path while rewriting
This commit is contained in:
@@ -2074,6 +2074,13 @@
|
|||||||
return $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
|
return $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanup_url_path($path) {
|
||||||
|
$path = str_replace("/./", "/", $path);
|
||||||
|
$path = str_replace("//", "/", $path);
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a (possibly) relative URL to a absolute one.
|
* Converts a (possibly) relative URL to a absolute one.
|
||||||
*
|
*
|
||||||
@@ -2094,6 +2101,7 @@
|
|||||||
} else if (strpos($rel_url, "/") === 0) {
|
} else if (strpos($rel_url, "/") === 0) {
|
||||||
$parts = parse_url($url);
|
$parts = parse_url($url);
|
||||||
$parts['path'] = $rel_url;
|
$parts['path'] = $rel_url;
|
||||||
|
$parts['path'] = cleanup_url_path($parts['path']);
|
||||||
|
|
||||||
return build_url($parts);
|
return build_url($parts);
|
||||||
|
|
||||||
@@ -2108,6 +2116,7 @@
|
|||||||
$dir !== '/' && $dir .= '/';
|
$dir !== '/' && $dir .= '/';
|
||||||
}
|
}
|
||||||
$parts['path'] = $dir . $rel_url;
|
$parts['path'] = $dir . $rel_url;
|
||||||
|
$parts['path'] = cleanup_url_path($parts['path']);
|
||||||
|
|
||||||
return build_url($parts);
|
return build_url($parts);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user