Skip to content

Commit

Permalink
fix(next/image): normalize root path according to trailingSlash optio…
Browse files Browse the repository at this point in the history
…n in default loader vercel#21337
  • Loading branch information
fliptheweb committed Feb 23, 2021
1 parent 4b587d3 commit c2d0455
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/next/client/image.tsx
Expand Up @@ -8,6 +8,7 @@ import {
VALID_LOADERS,
} from '../next-server/server/image-config'
import { useIntersection } from './use-intersection'
import { normalizePathTrailingSlash } from './normalize-trailing-slash'

if (typeof window === 'undefined') {
;(global as any).__NEXT_IMAGE_IMPORTED = true
Expand Down Expand Up @@ -540,5 +541,7 @@ function defaultLoader({
}
}

return `${root}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`
return `${normalizePathTrailingSlash(root)}?url=${encodeURIComponent(
src
)}&w=${width}&q=${quality || 75}`
}

0 comments on commit c2d0455

Please sign in to comment.