Fix some property bugs

- Parse values that should have been objects but came as strings
- Decode SearchMixin.searchUrl
This commit is contained in:
nathan 2022-09-08 11:17:34 -06:00
parent 3fdad7c160
commit f85de279c6
2 changed files with 8 additions and 1 deletions

View File

@ -315,6 +315,8 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
if(changedProperties.has("searchUrl") && this.searchUrl) if(changedProperties.has("searchUrl") && this.searchUrl)
{ {
this.search = true; 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 = <T extends Constructor<LitElement>>(superclass
*/ */
protected remoteQuery(search : string, options : object) 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) => {query: search, ...options}), [search, options]).then((result) =>
{ {
this.processRemoteResults(result); this.processRemoteResults(result);

View File

@ -1461,6 +1461,11 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes)
attrValue = widget.egw().lang(attrValue); 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; break;
} }