[enh] sanitize url in add_or_update.py
This commit is contained in:
parent
309f8e5b08
commit
b7b81baae1
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user