summaryrefslogtreecommitdiffstats
path: root/gitsrht/blueprints/repo.py
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-10-02 06:43:04 -0400
committerDrew DeVault <sir@cmpwn.com>2018-10-02 06:43:04 -0400
commit4defb1dfe58c6fd27c5e851c453e7714fa943417 (patch)
treead2bcf9fce061bbdc6cb6c40d7210433cd68da79 /gitsrht/blueprints/repo.py
parent8c3c149bcf6834b4d38de97fbd88825940c85119 (diff)
Improvements to archive generation
Use a randomized path and re-raise exceptions for debugging use
Diffstat (limited to 'gitsrht/blueprints/repo.py')
-rw-r--r--gitsrht/blueprints/repo.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py
index ee69596..65e8e99 100644
--- a/gitsrht/blueprints/repo.py
+++ b/gitsrht/blueprints/repo.py
@@ -1,3 +1,4 @@
+import binascii
import os
import pygit2
import pygments
@@ -190,7 +191,7 @@ def archive(owner, repo, ref):
git_repo = CachedRepository(repo.path)
commit, ref = lookup_ref(git_repo, ref)
- path = f"/tmp/{commit.id.hex}.tar.gz"
+ path = f"/tmp/{commit.id.hex}{binascii.hexlify(os.urandom(8)}.tar.gz"
try:
args = [
"git",
@@ -208,7 +209,7 @@ def archive(owner, repo, ref):
os.unlink(path)
except:
pass
- return "Error preparing archive", 500
+ raise
if subp.returncode != 0:
print(subp.stdout, subp.stderr)