From b88ce1863905b5bcaed1aec9c04958a331a1dbcd Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 4 Aug 2022 16:15:04 -0600 Subject: [PATCH] Fix invalid template names caused by appending cache_buster incorrectly 38721229b0b9f821711c54b942be9f6cfd249835 --- api/js/etemplate/Et2Dialog/Et2Dialog.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/api/js/etemplate/Et2Dialog/Et2Dialog.ts b/api/js/etemplate/Et2Dialog/Et2Dialog.ts index 1c8e991c6b..abf586c651 100644 --- a/api/js/etemplate/Et2Dialog/Et2Dialog.ts +++ b/api/js/etemplate/Et2Dialog/Et2Dialog.ts @@ -524,17 +524,6 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo { let old_template = this.__template; this.__template = new_template_name; - // inject preprocessor, if not already in template-url - const webserverUrl = this.egw().webserverUrl; - if (!new_template_name.match(new RegExp(webserverUrl+'/api/etemplate.php'))) - { - this.__template = new_template_name.replace(new RegExp(webserverUrl), webserverUrl+'/api/etemplate.php'); - } - // if we have no cache-buster, reload daily - if (this.__template.indexOf('?') === -1) - { - this.__template += '?'+((new Date).valueOf()/86400|0).toString(); - } this.requestUpdate("template", old_template); } @@ -580,8 +569,20 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo if(this.__template.indexOf('.xet') > 0) { + let template = this.__template; + // inject preprocessor, if not already in template-url + const webserverUrl = this.egw().webserverUrl; + if(!template.match(new RegExp(webserverUrl + '/api/etemplate.php'))) + { + template = template.replace(new RegExp(webserverUrl), webserverUrl + '/api/etemplate.php'); + } + // if we have no cache-buster, reload daily + if(template.indexOf('?') === -1) + { + template += '?' + ((new Date).valueOf() / 86400 | 0).toString(); + } // File name provided, fetch from server - this._template_promise = this._template_widget.load("", this.__template, this.__value || {content: {}},); + this._template_promise = this._template_widget.load("", template, this.__value || {content: {}},); } else {