comparison bin/url @ 9075:c989a1669243

<fizzie> revert 58b9ee8f97a7
author HackBot
date Sun, 25 Sep 2016 20:31:46 +0000
parents
children bae4827d5de8
comparison
equal deleted inserted replaced
9074:560a73f4f0a4 9075:c989a1669243
1 #!/usr/bin/env python
2 import sys, os.path, re, urllib
3 if len(sys.argv) <= 1:
4 print "http://codu.org/projects/hackbot/fshg/"
5 else:
6 f = os.path.abspath(sys.argv[1])
7 f = re.sub(r"^/+hackenv/", "", f)
8 if re.match(r"/|(?:\.hg|tmp)(?:/|$)",f):
9 sys.exit("File is outside web-viewable filesystem repository.")
10 else:
11 print ("http://codu.org/projects/hackbot/fshg/index.cgi/file/tip/" +
12 urllib.quote(f))