@fluid-topics/ft-wc-utils 1.2.68 → 1.2.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -29,6 +29,7 @@ export declare class SearchPlaceConverter {
|
|
|
29
29
|
serialize(request: EnrichedFtSearchRequest, searchPage?: string): string;
|
|
30
30
|
serializeToCurrentPageIfPossible(request: EnrichedFtSearchRequest, searchPage?: string): string;
|
|
31
31
|
toURLSearchParams(request: EnrichedFtSearchRequest, omitContentLocaleIfDefault?: boolean): string;
|
|
32
|
+
private encodeQueryString;
|
|
32
33
|
parse(url: string): EnrichedFtSearchRequest;
|
|
33
34
|
fromURLSearchParams(strParams: string): EnrichedFtSearchRequest;
|
|
34
35
|
private parseCompatFilters;
|
|
@@ -112,8 +112,19 @@ export class SearchPlaceConverter {
|
|
|
112
112
|
for (let key in otherQueryParams) {
|
|
113
113
|
params.append(key, otherQueryParams[key]);
|
|
114
114
|
}
|
|
115
|
+
// Use encodeURIComponent instead of URLSearchParams.toString() to encode the result
|
|
116
|
+
// encodeURIComponent encodes everything but characters - _ . ! ~ * ' ( )
|
|
117
|
+
// To be compliant with the expected "application/x-www-form-urlencoded" we must also replace spaces by "+" (instead of %20)
|
|
118
|
+
const result = new Array();
|
|
119
|
+
params.forEach((value, key) => {
|
|
120
|
+
result.push(this.encodeQueryString(key) + "=" + this.encodeQueryString(value));
|
|
121
|
+
});
|
|
115
122
|
// GWT needs the query string to be encoded twice 🙄
|
|
116
|
-
return encodeURI(
|
|
123
|
+
return encodeURI(result.join("&")).replace(/#/g, "%23");
|
|
124
|
+
}
|
|
125
|
+
encodeQueryString(value) {
|
|
126
|
+
return encodeURIComponent(value)
|
|
127
|
+
.replace(/%20/g, "+");
|
|
117
128
|
}
|
|
118
129
|
parse(url) {
|
|
119
130
|
var _a;
|