Skip to content

Commit 9fed3c5

Browse files
fix(client): preserve URL params already embedded in path
1 parent f8f62ae commit 9fed3c5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,9 @@ export class ImageKit {
357357
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
358358

359359
const defaultQuery = this.defaultQuery();
360-
if (!isEmptyObj(defaultQuery)) {
361-
query = { ...defaultQuery, ...query };
360+
const pathQuery = Object.fromEntries(url.searchParams);
361+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
362+
query = { ...pathQuery, ...defaultQuery, ...query };
362363
}
363364

364365
if (typeof query === 'object' && query && !Array.isArray(query)) {

0 commit comments

Comments
 (0)