Skip to content

Commit

Permalink
fix: replace // characters in ipx urls
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 15, 2024
1 parent f507ba7 commit 7704f70
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 0 additions & 4 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ export default defineNuxtConfig({
'$1',
)

if (route.fileName?.endsWith('.html') && route.contents) {
route.contents = route.contents.replace(/(src|href|srcset)="\/_ipx[^"]+"/g, r => r.replaceAll('//', '/'))
}

if (route.error) {
if (route.route.startsWith('/_ipx')) {
console.warn('Could not prerender', route.route)
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
"@unhead/vue": "1.11.11",
"unhead": "1.11.11",
"vue": "3.5.12"
},
"patchedDependencies": {
"@nuxt/image": "patches/@nuxt__image.patch"
}
}
}
14 changes: 14 additions & 0 deletions patches/@nuxt__image.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/dist/runtime/providers/ipx.js b/dist/runtime/providers/ipx.js
index 434c1a9ffa42cfcff730623dd22cdf89f1efcc47..5e914567a6743e5e2527eed61f88489bd58c8624 100644
--- a/dist/runtime/providers/ipx.js
+++ b/dist/runtime/providers/ipx.js
@@ -24,7 +24,8 @@ export const getImage = (src, { modifiers = {}, baseURL } = {}, ctx) => {
baseURL = joinURL(ctx.options.nuxt.baseURL, "/_ipx");
}
return {
- url: joinURL(baseURL, params, encodePath(src))
+ // TODO: port to ipxStatic
+ url: joinURL(baseURL, params, encodePath(src).replace(/\/\//g, '/'))
};
};
export const validateDomains = true;
9 changes: 7 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7704f70

Please sign in to comment.