From 71baa8654cfb033ff7e3b5ae9c2d4c0fcf7c4cd9 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 14 Nov 2019 15:19:58 +0100 Subject: [PATCH] fix wired CSP error after some 404 in html content --- api/js/etemplate/et2_core_xml.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_core_xml.js b/api/js/etemplate/et2_core_xml.js index a1a1a6dec0..be836ea850 100644 --- a/api/js/etemplate/et2_core_xml.js +++ b/api/js/etemplate/et2_core_xml.js @@ -44,7 +44,10 @@ function et2_loadXMLFromURL(_url, _callback, _context, _fail_callback) win = top; } 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, type: 'GET', 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); if(typeof _fail_callback !== 'undefined') { - _fail_callback.call(_context, _err) + _fail_callback.call(_context, _err); } } });