From 567852d6e9bed6894a1902f7f5ebee81056d1882 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 28 Sep 2018 17:32:58 +0200 Subject: httpdocs/index.php: support adding a prefix to the archive --- httpdocs/index.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'httpdocs') diff --git a/httpdocs/index.php b/httpdocs/index.php index f912908..2bda913 100644 --- a/httpdocs/index.php +++ b/httpdocs/index.php @@ -65,8 +65,18 @@ if (isset($_GET['r'])) { )) == '0') die('Commit ' . $commit_identifier . ' is not signed by ' . $_GET['valid_keys']); } + if (isset($_GET['p'])) { + if (base64_decode($_GET['p'],true)===false) + die('Invalid base64'); + $prefix = ' --prefix="$(' . + 'echo "' . $_GET['p'] . '" | ' . + 'base64 -d' . + ')"'; + } else { + $prefix = ''; + } $handle = popen( - 'git -C "../work/repositories/' . $_GET['r'] . '" archive "' . $commit_identifier . '" | ' . + 'git -C "../work/repositories/' . $_GET['r'] . '" archive' . $prefix . ' "' . $commit_identifier . '" | ' . 'gzip -nc', 'r' ); -- cgit v1.2.3-54-g00ecf