Fixed buggy gopher support

This commit is contained in:
aewens 2018-10-04 11:34:00 -04:00
parent 81bf0a5cca
commit 99be0c244d
1 changed files with 3 additions and 3 deletions

View File

@ -132,15 +132,15 @@ def is_fhost_url(url):
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
def shorten(url):
if len(url) > app.config["MAX_URL_LENGTH"]:
abort(414)
# handler to convert gopher links to HTTP(S) proxy
gopher = "gopher://"
length = len(gopher)
if url[:length] == gopher:
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:
abort(400)