From 03fd6b20179130bc3d078ed6cca18df2a40b7574 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 26 Mar 2016 11:44:04 +0100 Subject: [PATCH] [title] Restrict accepted URLs (only https?://) --- title.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/title.py b/title.py index 74a4cb1..1558092 100755 --- a/title.py +++ b/title.py @@ -14,10 +14,12 @@ def title(phenny, input): uri = input.group(2) if uri: uri = uri.strip() + if not uri.startswith("http://") and not uri.startswith("https://"): + return phenny.say("That's not a valid URL") elif hasattr(phenny.bot, 'last_seen_uri'): uri = phenny.bot.last_seen_uri else: - return phenny.reply("Give me an URI..") + return phenny.reply("Give me a link.") data, sc = web.get(uri, 16384) if sc != 200: return phenny.say("HTTP error %d" % sc)