~edwargix/git.sr.ht

4defb1dfe58c6fd27c5e851c453e7714fa943417 — Drew DeVault 6 years ago 8c3c149
Improvements to archive generation

Use a randomized path and re-raise exceptions for debugging use
1 files changed, 3 insertions(+), 2 deletions(-)

M gitsrht/blueprints/repo.py
M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +3 -2
@@ 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)