Fix query param handling in file interface (#3977)

Fixes #3944
This commit is contained in:
Rijk van Zanten
2021-02-08 17:44:36 -05:00
committed by GitHub
parent 239c021f12
commit f3cb3ddc2b
3 changed files with 15 additions and 8 deletions

View File

@@ -0,0 +1,9 @@
export function addQueryToPath(path: string, query: Record<string, string>) {
const queryParams = [];
for (const [key, value] of Object.entries(query)) {
queryParams.push(`${key}=${value}`);
}
return path.includes('?') ? `${path}&${queryParams.join('&')}` : `${path}?${queryParams.join('&')}`;
}