mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Fix crash on reading mod.conf from Github
This commit is contained in:
parent
776a3eff2a
commit
6ce495fcd3
@ -55,6 +55,9 @@ class GithubURLMaker:
|
|||||||
def getScreenshotURL(self):
|
def getScreenshotURL(self):
|
||||||
return self.baseUrl + "/screenshot.png"
|
return self.baseUrl + "/screenshot.png"
|
||||||
|
|
||||||
|
def getModConfURL(self):
|
||||||
|
return self.baseUrl + "/mod.conf"
|
||||||
|
|
||||||
def getCommitsURL(self, branch):
|
def getCommitsURL(self, branch):
|
||||||
return "https://api.github.com/repos/{}/{}/commits?sha={}" \
|
return "https://api.github.com/repos/{}/{}/commits?sha={}" \
|
||||||
.format(self.user, self.repo, urllib.parse.quote_plus(branch))
|
.format(self.user, self.repo, urllib.parse.quote_plus(branch))
|
||||||
@ -346,7 +349,7 @@ def makeVCSReleaseFromGithub(id, branch, release, url):
|
|||||||
try:
|
try:
|
||||||
contents = urllib.request.urlopen(commitsURL).read().decode("utf-8")
|
contents = urllib.request.urlopen(commitsURL).read().decode("utf-8")
|
||||||
commits = json.loads(contents)
|
commits = json.loads(contents)
|
||||||
except urllib.error.HTTPError:
|
except HTTPError:
|
||||||
raise TaskError("Unable to get commits for Github repository. Either the repository or reference doesn't exist.")
|
raise TaskError("Unable to get commits for Github repository. Either the repository or reference doesn't exist.")
|
||||||
|
|
||||||
if len(commits) == 0 or not "sha" in commits[0]:
|
if len(commits) == 0 or not "sha" in commits[0]:
|
||||||
|
Loading…
Reference in New Issue
Block a user