proxy_url: Fix extension extraction for URLs containing a . after a ?
This commit is contained in:
parent
8ec5b06e04
commit
f334f9e61f
1 changed files with 8 additions and 8 deletions
|
@ -281,14 +281,14 @@ function proxy_url($url, $writemode = false, $size = '') {
|
||||||
|
|
||||||
$longpath .= '/' . strtr(base64_encode($url), '+/', '-_');
|
$longpath .= '/' . strtr(base64_encode($url), '+/', '-_');
|
||||||
|
|
||||||
// Checking for valid extensions. Only add them if they are safe
|
// Extract the URL extension, disregarding GET parameters starting with ?
|
||||||
$pos = strrpos($url, '.');
|
$question_mark_pos = strpos($url, '?');
|
||||||
if ($pos) {
|
if ($question_mark_pos === false) {
|
||||||
$extension = strtolower(substr($url, $pos + 1));
|
$question_mark_pos = strlen($url);
|
||||||
$pos = strpos($extension, '?');
|
}
|
||||||
if ($pos) {
|
$dot_pos = strrpos($url, '.', $question_mark_pos - strlen($url));
|
||||||
$extension = substr($extension, 0, $pos);
|
if ($dot_pos !== false) {
|
||||||
}
|
$extension = strtolower(substr($url, $dot_pos + 1, $question_mark_pos - ($dot_pos + 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$extensions = array('jpg', 'jpeg', 'gif', 'png');
|
$extensions = array('jpg', 'jpeg', 'gif', 'png');
|
||||||
|
|
Loading…
Reference in a new issue