From f00e97d2943c34d569c8fdbc5249ce19d6187987 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Tue, 9 Jan 2024 22:30:03 +0100 Subject: [PATCH] fix: fix problem with URL parsing --- www/router.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/router.php b/www/router.php index 4f2f0d8..e65719b 100644 --- a/www/router.php +++ b/www/router.php @@ -202,7 +202,7 @@ function generate_website($SURI) { header('Etag: W/"' . $SURI . '/' . strtotime($feed['feed_ts']) . '"'); echo $feed['feed']; - } elseif(preg_match('/^\s*image/', $_SERVER['HTTP_ACCEPT'])) { + } elseif(!preg_match('/^\s*text\/html/', $_SERVER['HTTP_ACCEPT'])) { header('Location: /raw' . $SURI); exit(0); } elseif(true) { @@ -210,8 +210,9 @@ function generate_website($SURI) { } } -generate_website($_SERVER['REQUEST_URI']); +$URL_PATH = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); +generate_website($URL_PATH); -log_and_die($_SERVER['REQUEST_URI']); +log_and_die($URL_PATH); ?>