[FIX] web_linkedin: possible problem with loading of images
lp bug: https://launchpad.net/bugs/1116226 fixed bzr revid: nicolas.vanhoren@openerp.com-20130206151105-4xgxm350yje4vhtb
This commit is contained in:
parent
33ae77e803
commit
222802f001
|
@ -29,7 +29,12 @@ class Binary(openerp.addons.web.http.Controller):
|
||||||
_cp_path = "/web_linkedin/binary"
|
_cp_path = "/web_linkedin/binary"
|
||||||
|
|
||||||
@openerp.addons.web.http.jsonrequest
|
@openerp.addons.web.http.jsonrequest
|
||||||
def url2binary(self, req,url):
|
def url2binary(self, req, url):
|
||||||
|
if not url.startswith("http"):
|
||||||
|
raise Exception("Not allowed to load a file using this protocol")
|
||||||
|
if url.count("?") > 0 or url.count("&") > 0 or url.count("=") > 0:
|
||||||
|
raise Exception("Not allowed to use GET parameters")
|
||||||
|
req.session.assert_valid(force=True)
|
||||||
bfile = urllib2.urlopen(url)
|
bfile = urllib2.urlopen(url)
|
||||||
return base64.b64encode(bfile.read())
|
return base64.b64encode(bfile.read())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue