From 99b4ce7d5878b9cf2abedb56fa268b56c8636356 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Fri, 10 Oct 2014 23:25:35 +0200 Subject: [PATCH] imgur: Restrict URL to imgur domains Otherwise it would crash any pastoob get! --- modules/imgur/module.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/imgur/module.py b/modules/imgur/module.py index 07712532..035c4c6e 100644 --- a/modules/imgur/module.py +++ b/modules/imgur/module.py @@ -23,6 +23,7 @@ from weboob.capabilities.paste import CapPaste, BasePaste from weboob.tools.capabilities.paste import image_mime from weboob.capabilities.base import StringField from weboob.deprecated.browser import StandardBrowser +from weboob.deprecated.browser.decorators import check_url from urllib import urlencode import re @@ -91,6 +92,7 @@ class ImgurModule(Module, CapPaste): paste.id = json['data']['id'] paste.delete_url = 'https://api.imgur.com/3/image/%s' % json['data']['deletehash'] + @check_url('https?://(?:[a-z]+\.)?imgur.com/') def get_paste(self, id): paste = ImgPaste(id) paste.contents = self.browser.readurl(paste.raw_url).encode('base64')