forked from tildeverse/ttm.sh
Fixed buggy gopher support
This commit is contained in:
parent
81bf0a5cca
commit
99be0c244d
6
fhost.py
6
fhost.py
|
@ -132,15 +132,15 @@ def is_fhost_url(url):
|
||||||
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
|
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
|
||||||
|
|
||||||
def shorten(url):
|
def shorten(url):
|
||||||
if len(url) > app.config["MAX_URL_LENGTH"]:
|
|
||||||
abort(414)
|
|
||||||
|
|
||||||
# handler to convert gopher links to HTTP(S) proxy
|
# handler to convert gopher links to HTTP(S) proxy
|
||||||
gopher = "gopher://"
|
gopher = "gopher://"
|
||||||
length = len(gopher)
|
length = len(gopher)
|
||||||
if url[:length] == gopher:
|
if url[:length] == gopher:
|
||||||
url = "https://gopher.tilde.team/{}".format(url[length:])
|
url = "https://gopher.tilde.team/{}".format(url[length:])
|
||||||
|
|
||||||
|
if len(url) > app.config["MAX_URL_LENGTH"]:
|
||||||
|
abort(414)
|
||||||
|
|
||||||
if not url_valid(url) or is_fhost_url(url) or "\n" in url:
|
if not url_valid(url) or is_fhost_url(url) or "\n" in url:
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue