diff --git a/fhost.py b/fhost.py index 0f2afd4..95fe375 100755 --- a/fhost.py +++ b/fhost.py @@ -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)