summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-07-12 10:37:19 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-12 10:37:19 -0400
commitefd00ff61c924eeba492def943a1d455ca2336b4 (patch)
tree5468b1fe7aadc295d8fa505315704ea0b8813575
parent031b8825a6603fb76e5f46e7b36406114c07d3fb (diff)
Fix unbound local when fetching log of empty repo
-rw-r--r--gitsrht/blueprints/api.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gitsrht/blueprints/api.py b/gitsrht/blueprints/api.py
index 121b7e0..3b1c90a 100644
--- a/gitsrht/blueprints/api.py
+++ b/gitsrht/blueprints/api.py
@@ -85,7 +85,7 @@ def repo_refs_GET(username, reponame):
defaults={"ref": None, "path": ""})
@data.route("/api/<username>/repos/<reponame>/log/<path:ref>",
defaults={"path": ""})
-@data.route("/api/repos/<username>/<reponame>/log/<ref>/<path:path>")
+@data.route("/api/<username>/repos/<reponame>/log/<ref>/<path:path>")
@oauth("data:read")
def repo_commits_GET(username, reponame, ref, path):
user = get_user(username)
@@ -94,7 +94,7 @@ def repo_commits_GET(username, reponame, ref, path):
commits_per_page=50
with GitRepository(repo.path) as git_repo:
if git_repo.is_empty:
- return { "next": next_id, "results": [],
+ return { "next": None, "results": [],
"total": 0, "results_per_page": commits_per_page }
commit, ref, path = lookup_ref(git_repo, ref, path)
start = request.args.get("start")