Merge branch 'master' into feature/sql-query-aliasing

This commit is contained in:
Michael Drury 2024-02-27 14:54:46 +00:00 committed by GitHub
commit abf68fdd36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{
"version": "2.20.11",
"version": "2.20.12",
"npmClient": "yarn",
"packages": [
"packages/*",

View File

@ -106,11 +106,12 @@
/>
<Label small>Export columns</Label>
<ColumnEditor
bind:value={parameters.columns}
value={parameters.columns}
allowCellEditing={false}
componentInstance={selectedTable}
on:change={e => {
const columns = e.detail
parameters.columns = columns
parameters.customHeaders = columns.reduce((headerMap, column) => {
return {
[column.name]: column.displayName,

View File

@ -17,6 +17,10 @@ export function breakQueryString(qs) {
return paramObj
}
function isEncoded(str) {
return typeof str == "string" && decodeURIComponent(str) !== str
}
export function buildQueryString(obj) {
let str = ""
if (obj) {
@ -35,7 +39,7 @@ export function buildQueryString(obj) {
value = value.replace(binding, marker)
bindingMarkers[marker] = binding
})
let encoded = encodeURIComponent(value || "")
let encoded = isEncoded(value) ? value : encodeURIComponent(value || "")
Object.entries(bindingMarkers).forEach(([marker, binding]) => {
encoded = encoded.replace(marker, binding)
})

View File

@ -39,4 +39,11 @@ describe("check query string utils", () => {
expect(broken.key1).toBe(obj2.key1)
expect(broken.key2).toBe(obj2.key2)
})
it("should not encode a URL more than once when building the query string", () => {
const queryString = buildQueryString({
values: "a%2Cb%2Cc",
})
expect(queryString).toBe("values=a%2Cb%2Cc")
})
})