diff options
author | Erich Eckner <git@eckner.net> | 2018-09-28 17:32:58 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-09-28 17:32:58 +0200 |
commit | 567852d6e9bed6894a1902f7f5ebee81056d1882 (patch) | |
tree | 74196ea1dec58e53e76193a0f47b2d17a4f679cd /httpdocs/index.php | |
parent | c1666bbbb90937b0c6444f1d60a9fbdcfc75abb6 (diff) | |
download | archive-server-567852d6e9bed6894a1902f7f5ebee81056d1882.tar.xz |
httpdocs/index.php: support adding a prefix to the archive
Diffstat (limited to 'httpdocs/index.php')
-rw-r--r-- | httpdocs/index.php | 12 |
1 files changed, 11 insertions, 1 deletions
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' ); |