comparison bin/url @ 11468:ff752d36eb0e draft

<fizzie> sled bin/url//s,https://hackego.esolangs.org/,https://hack.esolangs.org/,
author HackEso <hackeso@esolangs.org>
date Sun, 08 Apr 2018 18:18:04 +0100
parents 380e297c7ae5
children
comparison
equal deleted inserted replaced
11467:380e297c7ae5 11468:ff752d36eb0e
6 f = os.path.abspath(sys.argv[1]) 6 f = os.path.abspath(sys.argv[1])
7 f = re.sub(r"^/+hackenv/", "", f) 7 f = re.sub(r"^/+hackenv/", "", f)
8 if re.match(r"/|\.hg(?:/|$)",f): 8 if re.match(r"/|\.hg(?:/|$)",f):
9 sys.exit("File is outside web-viewable filesystem repository.") 9 sys.exit("File is outside web-viewable filesystem repository.")
10 elif re.match(r"tmp(?:/|$)",f): 10 elif re.match(r"tmp(?:/|$)",f):
11 print ("https://hackego.esolangs.org/" + urllib.quote(f)) 11 print ("https://hack.esolangs.org/" + urllib.quote(f))
12 else: 12 else:
13 print ("https://hack.esolangs.org/repo/file/tip/" + 13 print ("https://hack.esolangs.org/repo/file/tip/" +
14 urllib.quote(f)) 14 urllib.quote(f))