Bugfix
This commit is contained in:
@@ -84,12 +84,24 @@ class PdfIndexService
|
|||||||
* ===================================================== */
|
* ===================================================== */
|
||||||
private function normalizePdfUrl(string $url): ?string
|
private function normalizePdfUrl(string $url): ?string
|
||||||
{
|
{
|
||||||
$url = html_entity_decode($url);
|
// Fall 1: direkter /files/-Pfad
|
||||||
|
if (str_starts_with($url, '/files/') && str_ends_with($url, '.pdf')) {
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
// direkter /files/*.pdf-Link
|
// Fall 2: Contao-Download-Link mit ?p=
|
||||||
$path = parse_url($url, PHP_URL_PATH);
|
$decoded = html_entity_decode($url);
|
||||||
if ($path && preg_match('~^/files/.*\.pdf$~i', $path)) {
|
|
||||||
return $path;
|
$parts = parse_url($decoded);
|
||||||
|
if (!isset($parts['query'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_str($parts['query'], $query);
|
||||||
|
|
||||||
|
if (!empty($query['p'])) {
|
||||||
|
// Contao speichert Pfade relativ zu /files
|
||||||
|
return '/files/' . ltrim($query['p'], '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user