diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-02 06:43:04 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-10-02 06:43:04 -0400 |
commit | 4defb1dfe58c6fd27c5e851c453e7714fa943417 (patch) | |
tree | ad2bcf9fce061bbdc6cb6c40d7210433cd68da79 /gitsrht/blueprints/repo.py | |
parent | 8c3c149bcf6834b4d38de97fbd88825940c85119 (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.py | 5 |
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) |