From d0ea43788da6d096b51880a11d2debb1cb79eff1 Mon Sep 17 00:00:00 2001 From: Codeberg Date: Fri, 18 Oct 2019 09:48:43 +0200 Subject: [PATCH] strtolower(owner) --- var/www/pages/index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/var/www/pages/index.php b/var/www/pages/index.php index 3672a5d..ddba4a6 100644 --- a/var/www/pages/index.php +++ b/var/www/pages/index.php @@ -18,9 +18,8 @@ if (preg_match("/\/[a-zA-Z0-9_ +\-\/\.]+\z/", $request_url) != 1) { $parts = explode("/", $request_url); array_shift($parts); # remove empty first - -$git_root = "/data/git/gitea-repositories/" . array_shift($parts) . "/pages.git"; - +$owner = strtolower(array_shift($parts)); +$git_root = "/data/git/gitea-repositories/$owner/pages.git"; $file_url = implode("/", $parts); if (!is_dir($git_root)) { @@ -37,6 +36,8 @@ if ($retval != 0) { } $ext = pathinfo($file_url, PATHINFO_EXTENSION); +$ext = strtolower($ext); + if ($ext == "svg") { header("Content-Type: image/svg+xml"); } elseif ($ext == "jpg") {