From f85de279c64a4f9b1ed05fc7d4efc17bd364e888 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 8 Sep 2022 11:17:34 -0600 Subject: [PATCH] Fix some property bugs - Parse values that should have been objects but came as strings - Decode SearchMixin.searchUrl --- api/js/etemplate/Et2Select/SearchMixin.ts | 4 +++- api/js/etemplate/Et2Widget/Et2Widget.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Select/SearchMixin.ts b/api/js/etemplate/Et2Select/SearchMixin.ts index e245dc8d95..dace217ce5 100644 --- a/api/js/etemplate/Et2Select/SearchMixin.ts +++ b/api/js/etemplate/Et2Select/SearchMixin.ts @@ -315,6 +315,8 @@ export const Et2WithSearchMixin = >(superclass if(changedProperties.has("searchUrl") && this.searchUrl) { this.search = true; + // Decode URL, possibly again. If set in template, it can wind up double-encoded. + this.searchUrl = this.egw().decodePath(this.searchUrl); } } @@ -840,7 +842,7 @@ export const Et2WithSearchMixin = >(superclass */ protected remoteQuery(search : string, options : object) { - return this.egw().request(this.egw().link(this.egw().ajaxUrl(this.searchUrl), + return this.egw().request(this.egw().link(this.egw().ajaxUrl(this.egw().decodePath(this.searchUrl)), {query: search, ...options}), [search, options]).then((result) => { this.processRemoteResults(result); diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index df03d18c60..a00301485f 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -1461,6 +1461,11 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes) attrValue = widget.egw().lang(attrValue); } } + else if(attrValue && [Object, Array].indexOf(typeof property === "object" ? property.type : property) != -1) + { + // Value was not supposed to be a string, but was run through here for expandName + attrValue = JSON.parse(attrValue); + } break; }