-
Notifications
You must be signed in to change notification settings - Fork 311
Open
Description
This line:
image/src/runtime/providers/shopify.ts
Line 39 in db87207
| url: withBase(joinURL(src + (operations ? ('?' + operations) : '')), baseURL), |
Does not check if there already are URL params on the source before appending the new ones.
Shopify often has an asset version in the URL,
ex: ...jpg?v=1763534395
which was causing issues with double "?"
ex: ?v=1763534395?width=200
I have made a custom provider as a workaround, but it would be best to fix the original lib file.
export default defineProvider<ShopifyOptions>({
getImage: (src, { modifiers, baseURL = "" }) => {
const operations = operationsGenerator(modifiers);
const [baseUrl, existingQuery] = src.split("?", 2);
const mergedParams = new URLSearchParams(existingQuery || "");
if (operations) {
const operationsParams = new URLSearchParams(operations);
for (const [key, value] of operationsParams) {
mergedParams.set(key, value);
}
}
const queryString = mergedParams.toString();
return {
url: withBase(
joinURL(baseUrl + (queryString ? "?" + queryString : "")),
baseURL
),
};
},
});Metadata
Metadata
Assignees
Labels
No labels