Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions playground/app/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ export const providers: Provider[] = [
height: 300,
link: 'https://unsplash.com/@omidarmin?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText',
},
{
src: '/images/test+plus.png',
from: 'Filename with + (issue #1378)',
width: 300,
height: 300,
},
],
},
// Aliyun
Expand Down
Binary file added playground/public/images/test+plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/runtime/server/routes/_ipx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ export default lazyEventHandler(() => {
const ipx = createIPX(ipxOptions)
const nodeHandler = createIPXNodeHandler(ipx, {
parseURL(url) {
const parsedURL = new URL(url)
const parsedURL = new URL(url, 'http://localhost')
let pathname = parsedURL.pathname
if (baseURL && (pathname === baseURL || pathname.startsWith(`${baseURL}/`))) {
pathname = pathname.slice(baseURL.length) || '/'
}
try {
pathname = decodeURI(pathname)
}
catch {
// Keep original pathname if decoding fails.
}
return parseIPXURL(parsedURL.origin + pathname + parsedURL.search)
},
})
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/__snapshots__/ipx.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"/_ipx/s_300x300/images/colors.jpg",
"/_ipx/s_300x300/images/everest.jpg",
"/_ipx/s_300x300/images/tacos.svg",
"/_ipx/s_300x300/images/test%2Bplus.png",
"/_ipx/s_300x300/unsplash/photo-1606112219348-204d7d8b94ee",
],
"sources": [
Expand All @@ -14,5 +15,6 @@
"/_ipx/s_300x300/images/everest.jpg",
"/_ipx/s_300x300/images/tacos.svg",
"/_ipx/s_300x300/unsplash/photo-1606112219348-204d7d8b94ee",
"/_ipx/s_300x300/images/test%2Bplus.png",
],
}
2 changes: 2 additions & 0 deletions test/e2e/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ describe('ipx provider', () => {
"_ipx/s_300x300/images/colors.jpg",
"_ipx/s_300x300/images/everest.jpg",
"_ipx/s_300x300/images/tacos.svg",
"_ipx/s_300x300/images/test%2Bplus.png",
"_ipx/s_300x300/unsplash/photo-1606112219348-204d7d8b94ee",
"_ipx/s_600x600/images/colors-layer-config.jpg",
"_ipx/s_600x600/images/colors-layer.jpg",
"_ipx/s_600x600/images/colors.jpg",
"_ipx/s_600x600/images/everest.jpg",
"_ipx/s_600x600/images/tacos.svg",
"_ipx/s_600x600/images/test%2Bplus.png",
"_ipx/s_600x600/unsplash/photo-1606112219348-204d7d8b94ee",
]
`)
Expand Down
Loading