From 90ae20aea323781ccf167512e8cc71339c979c84 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 2 Oct 2025 23:56:16 +0200 Subject: [PATCH] Remove asset handling from language extraction section Move asset handling to after language extraction The asset handling code was previously located in the language extraction section, which could interfere with proper language detection. This commit moves the asset handling code to after the language extraction logic, ensuring that language detection works correctly before any asset handling occurs. --- app/router.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/router.php b/app/router.php index a8b4ef8..73220a6 100644 --- a/app/router.php +++ b/app/router.php @@ -13,14 +13,6 @@ $requestUri = parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH) ?: '/'; $hasTrailingSlash = str_ends_with($requestUri, '/') && $requestUri !== '/'; $requestPath = trim($requestUri, '/'); -// Check for assets in /custom/assets/ served at root level (before language extraction) -$assetPath = dirname(__DIR__) . '/custom/assets/' . $requestPath; -if (file_exists($assetPath) && is_file($assetPath)) { - header('Content-Type: ' . (mime_content_type($assetPath) ?: 'application/octet-stream')); - readfile($assetPath); - exit; -} - // Extract language from URL $currentLang = $defaultLang; $pathParts = explode('/', $requestPath); @@ -359,6 +351,14 @@ function renderFile(string $filePath): void { exit; } +// Check for assets in /custom/assets/ served at root level +$assetPath = dirname(__DIR__) . '/custom/assets/' . $requestPath; +if (file_exists($assetPath) && is_file($assetPath)) { + header('Content-Type: ' . (mime_content_type($assetPath) ?: 'application/octet-stream')); + readfile($assetPath); + exit; +} + // Handle frontpage if (empty($requestPath)) { // Try language-specific frontpage first, then default