aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2019-04-25 15:58:58 +0100
committerGravatar jesopo2019-04-25 15:58:58 +0100
commit7643a962bd29504bf48a23383109b7642700a349 (patch)
tree24eecb40a61ac6a682722e4a0694eeb36a4fcfc7 /modules
parentMake masterlogin passwords one-time-use (diff)
signature
Refuse to get the title for any url that points locall
Diffstat (limited to 'modules')
-rw-r--r--modules/title.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/title.py b/modules/title.py
index ddc0a50f..f1ea2b30 100644
--- a/modules/title.py
+++ b/modules/title.py
@@ -1,4 +1,4 @@
-import hashlib, re
+import hashlib, re, urllib.parse
from src import EventManager, ModuleManager, utils
@utils.export("channelset", {"setting": "auto-title",
@@ -14,6 +14,14 @@ class Module(ModuleManager.BaseModule):
).hexdigest()
def _get_title(self, url):
+ if not urllib.parse.urlparse(url).scheme:
+ url = "http://%s" % url
+
+ hostname = urllib.parse.urlparse(url).hostname
+ if utils.http.is_localhost(hostname):
+ self.log.warn("tried to get title of localhost: %s", [url])
+ return None
+
try:
page = utils.http.request(url, soup=True)
except utils.http.HTTPWrongContentTypeException: