aboutsummaryrefslogtreecommitdiff
path: root/app/tasks/importtasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/tasks/importtasks.py')
-rw-r--r--app/tasks/importtasks.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/tasks/importtasks.py b/app/tasks/importtasks.py
index 175e8a5..61b60d9 100644
--- a/app/tasks/importtasks.py
+++ b/app/tasks/importtasks.py
@@ -34,9 +34,9 @@ class GithubURLMaker:
return
user = m.group(1)
- repo = m.group(2)
+ repo = m.group(2).replace(".git", "")
self.baseUrl = "https://raw.githubusercontent.com/{}/{}/master" \
- .format(user, repo.replace(".git", ""))
+ .format(user, repo)
self.user = user
self.repo = repo
@@ -213,13 +213,15 @@ def makeVCSRelease(id, branch):
if not urlmaker.isValid():
raise TaskError("Invalid github repo URL")
- contents = urllib.request.urlopen(urlmaker.getCommitsURL(branch)).read().decode("utf-8")
+ commitsURL = urlmaker.getCommitsURL(branch)
+ contents = urllib.request.urlopen(commitsURL).read().decode("utf-8")
commits = json.loads(contents)
- if len(commits) == 0:
+ if len(commits) == 0 or not "sha" in commits[0]:
raise TaskError("No commits found")
release.url = urlmaker.getCommitDownload(commits[0]["sha"])
+ print(release.url)
release.task_id = None
db.session.commit()