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 defaul loader
  • Loading branch information
fliptheweb committed Mar 7, 2022
1 parent ff6b750 commit 788a3d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next/client/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { useIntersection } from './use-intersection'
import { ImageConfigContext } from '../shared/lib/image-config-context'
import { warnOnce } from '../shared/lib/utils'
import { normalizePathTrailingSlash } from './normalize-trailing-slash'

const configEnv = process.env.__NEXT_IMAGE_OPTS as any as ImageConfigComplete
const loadedImageURLs = new Set<string>()
Expand Down Expand Up @@ -877,7 +878,7 @@ function defaultLoader({
return src
}

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

0 comments on commit 788a3d1

Please sign in to comment.