summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-28 17:32:58 +0200
committerErich Eckner <git@eckner.net>2018-09-28 17:32:58 +0200
commit567852d6e9bed6894a1902f7f5ebee81056d1882 (patch)
tree74196ea1dec58e53e76193a0f47b2d17a4f679cd
parentc1666bbbb90937b0c6444f1d60a9fbdcfc75abb6 (diff)
downloadarchive-server-567852d6e9bed6894a1902f7f5ebee81056d1882.tar.xz
httpdocs/index.php: support adding a prefix to the archive
-rw-r--r--httpdocs/index.php12
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'
);