File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
packages/next/next-server/server
test/integration/image-component/default/test Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -218,18 +218,12 @@ function assignDefaults(userConfig: { [key: string]: any }) {
218
218
if ( result ?. images ) {
219
219
const { images } = result
220
220
221
- // Normalize defined image host to end in slash
222
- if ( images ?. path ) {
223
- if ( images . path [ images . path . length - 1 ] !== '/' ) {
224
- images . path += '/'
225
- }
226
- }
227
-
228
221
if ( typeof images !== 'object' ) {
229
222
throw new Error (
230
223
`Specified images should be an object received ${ typeof images } `
231
224
)
232
225
}
226
+
233
227
if ( images . domains ) {
234
228
if ( ! Array . isArray ( images . domains ) ) {
235
229
throw new Error (
@@ -306,6 +300,14 @@ function assignDefaults(userConfig: { [key: string]: any }) {
306
300
)
307
301
}
308
302
}
303
+
304
+ // Append trailing slash for non-default loaders
305
+ if ( images . path ) {
306
+ const isDefaultLoader = ! images . loader || images . loader === 'default'
307
+ if ( ! isDefaultLoader && images . path [ images . path . length - 1 ] !== '/' ) {
308
+ images . path += '/'
309
+ }
310
+ }
309
311
}
310
312
311
313
if ( result . experimental ?. i18n ) {
Original file line number Diff line number Diff line change @@ -71,10 +71,7 @@ function runTests(mode) {
71
71
expect (
72
72
await hasImageMatchingUrl (
73
73
browser ,
74
- mode === 'serverless'
75
- ? // FIXME: this is a bug
76
- `http://localhost:${ appPort } /_next/image/?url=%2Ftest.jpg&w=420&q=75`
77
- : `http://localhost:${ appPort } /_next/image?url=%2Ftest.jpg&w=420&q=75`
74
+ `http://localhost:${ appPort } /_next/image?url=%2Ftest.jpg&w=420&q=75`
78
75
)
79
76
) . toBe ( true )
80
77
} finally {
You can’t perform that action at this time.
0 commit comments