From 573e94f7a7dc24f9988129f4fbf8394ff838b8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 11 Aug 2022 11:00:19 +0200 Subject: [PATCH] repo.php: parameter file: load raw file from repository --- repo.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/repo.php b/repo.php index 1e4e5111..c58ab485 100644 --- a/repo.php +++ b/repo.php @@ -62,8 +62,20 @@ if ($branchId) { if (array_key_exists('file', $_REQUEST)) { $file = $repo->file_get_contents($_REQUEST['file']); - Header("Content-Type: text/plain; charset=utf/8"); - print $file; + + if ($file === false) { + Header("HTTP/1.1 403 Forbidden"); + print "Access denied."; + } + else if ($file === null) { + Header("HTTP/1.1 404 File not found"); + print "File not found."; + } + else { + Header("Content-Type: text/plain; charset=utf-8"); + print $file; + } + exit(0); }