Auto-add http: to URLs starting with //.

This commit is contained in:
Jim Miller 2014-06-18 21:28:42 -05:00
parent e477a9870d
commit d1b73b9a6a

View file

@ -209,6 +209,8 @@ def getConfigSectionFor(url):
def getClassFor(url):
## fix up leading protocol.
fixedurl = re.sub(r"(?i)^[htp]+(s?)[:/]+",r"http\1://",url.strip())
if fixedurl.startswith("//"):
fixedurl = "http:%s"%url
if not fixedurl.startswith("http"):
fixedurl = "http://%s"%url
## remove any trailing '#' locations.