fix wired CSP error after some 404 in html content

This commit is contained in:
Ralf Becker 2019-11-14 15:19:58 +01:00
parent 056e5c053a
commit 71baa8654c

View File

@ -44,7 +44,10 @@ function et2_loadXMLFromURL(_url, _callback, _context, _fail_callback)
win = top; win = top;
} }
win.jQuery.ajax({ win.jQuery.ajax({
url: _url, // we add the full url (protocol and domain) as sometimes just the path
// gives a CSP error interpreting it as file:///path
// (if there are a enough 404 errors in html content ...)
url: (_url[0]=='/' ? location.protocol+'//'+location.host : '')+_url,
context: _context, context: _context,
type: 'GET', type: 'GET',
dataType: 'xml', dataType: 'xml',
@ -55,7 +58,7 @@ function et2_loadXMLFromURL(_url, _callback, _context, _fail_callback)
egw().debug('error', 'Loading eTemplate from '+_url+' failed! '+_xmlhttp.status+' '+_xmlhttp.statusText); egw().debug('error', 'Loading eTemplate from '+_url+' failed! '+_xmlhttp.status+' '+_xmlhttp.statusText);
if(typeof _fail_callback !== 'undefined') if(typeof _fail_callback !== 'undefined')
{ {
_fail_callback.call(_context, _err) _fail_callback.call(_context, _err);
} }
} }
}); });