imgur: Restrict URL to imgur domains
Otherwise it would crash any pastoob get!
This commit is contained in:
parent
448c06d125
commit
99b4ce7d58
1 changed files with 2 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ from weboob.capabilities.paste import CapPaste, BasePaste
|
||||||
from weboob.tools.capabilities.paste import image_mime
|
from weboob.tools.capabilities.paste import image_mime
|
||||||
from weboob.capabilities.base import StringField
|
from weboob.capabilities.base import StringField
|
||||||
from weboob.deprecated.browser import StandardBrowser
|
from weboob.deprecated.browser import StandardBrowser
|
||||||
|
from weboob.deprecated.browser.decorators import check_url
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
@ -91,6 +92,7 @@ class ImgurModule(Module, CapPaste):
|
||||||
paste.id = json['data']['id']
|
paste.id = json['data']['id']
|
||||||
paste.delete_url = 'https://api.imgur.com/3/image/%s' % json['data']['deletehash']
|
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):
|
def get_paste(self, id):
|
||||||
paste = ImgPaste(id)
|
paste = ImgPaste(id)
|
||||||
paste.contents = self.browser.readurl(paste.raw_url).encode('base64')
|
paste.contents = self.browser.readurl(paste.raw_url).encode('base64')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue