1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

[enh] sanitize url in add_or_update.py

This commit is contained in:
Laurent Peuch 2016-05-04 17:02:49 +02:00
parent 309f8e5b08
commit b7b81baae1

View file

@ -27,6 +27,12 @@ if __name__ == '__main__':
content = json.load(open(sys.argv[1], "r")) content = json.load(open(sys.argv[1], "r"))
for url in sys.argv[2:]: for url in sys.argv[2:]:
if url.endswith("/"):
url = url[:-1]
if url.endswith(".git"):
url = url[:-len(".git")]
if not url.startswith("https://github.com"): if not url.startswith("https://github.com"):
sys.stderr.write("WARNING: url '%s' doesn't starts with https://github.com, skip it\n" % url) sys.stderr.write("WARNING: url '%s' doesn't starts with https://github.com, skip it\n" % url)