From 99be0c244d6ac36ff0f53ed7511d972106b7a15f Mon Sep 17 00:00:00 2001 From: aewens Date: Thu, 4 Oct 2018 11:34:00 -0400 Subject: [PATCH] Fixed buggy gopher support --- fhost.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)