Bugfix
This commit is contained in:
@@ -131,11 +131,13 @@ class PdfIndexService
|
|||||||
{
|
{
|
||||||
$url = html_entity_decode($url);
|
$url = html_entity_decode($url);
|
||||||
|
|
||||||
|
// 1) direkter Pfad /files/xyz.pdf
|
||||||
$path = parse_url($url, PHP_URL_PATH);
|
$path = parse_url($url, PHP_URL_PATH);
|
||||||
if ($path && str_ends_with(strtolower($path), '.pdf')) {
|
if ($path && str_ends_with(strtolower($path), '.pdf')) {
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2) Query-Parameter auswerten
|
||||||
$query = parse_url($url, PHP_URL_QUERY);
|
$query = parse_url($url, PHP_URL_QUERY);
|
||||||
if (!$query) {
|
if (!$query) {
|
||||||
return null;
|
return null;
|
||||||
@@ -143,16 +145,18 @@ class PdfIndexService
|
|||||||
|
|
||||||
parse_str($query, $params);
|
parse_str($query, $params);
|
||||||
|
|
||||||
if (empty($params['p'])) {
|
// 2a) Contao: p=pdf/xyz.pdf
|
||||||
return null;
|
if (!empty($params['p']) && str_ends_with(strtolower($params['p']), '.pdf')) {
|
||||||
|
return '/files/' . ltrim($params['p'], '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = ltrim($params['p'], '/');
|
// 2b) Contao: f=xyz.pdf (typischer Download-Link)
|
||||||
if (!str_ends_with(strtolower($p), '.pdf')) {
|
if (!empty($params['f']) && str_ends_with(strtolower($params['f']), '.pdf')) {
|
||||||
return null;
|
// Standard: PDFs liegen unter /files/pdf/
|
||||||
|
return '/files/pdf/' . ltrim($params['f'], '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
return '/files/' . $p;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAbsolutePath(string $url): ?string
|
private function getAbsolutePath(string $url): ?string
|
||||||
|
|||||||
Reference in New Issue
Block a user