File tree 2 files changed +6
-2
lines changed
packages/gatsby-plugin-image/src
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ export default function attrs({
50
50
}
51
51
52
52
// Adding the filename to the hashing, like in "extractStaticImageProps" function
53
- props . filename = state . filename
53
+ if ( state . filename ) {
54
+ props . filename = slash ( state . filename )
55
+ }
54
56
const hash = hashOptions ( props )
55
57
56
58
const cacheDir = ( this . opts as Record < string , string > ) ?. cacheDir
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { NodePath } from "@babel/core"
3
3
import { JSXOpeningElement } from "@babel/types"
4
4
import { parse , ParserOptions } from "@babel/parser"
5
5
import babel from "@babel/core"
6
+ import { slash } from "gatsby-core-utils"
6
7
import { evaluateImageAttributes , hashOptions } from "../babel-helpers"
7
8
import { IStaticImageProps } from "../components/static-image.server"
8
9
@@ -96,7 +97,8 @@ export const extractStaticImageProps = (
96
97
) as unknown as IStaticImageProps
97
98
// When the image props are the same for multiple StaticImage but they are in different locations
98
99
// the hash will be the same then. We need to make sure that the hash is unique.
99
- image . filename = filename
100
+ // The filename should already be normalized but better safe than sorry.
101
+ image . filename = slash ( filename )
100
102
101
103
images . set ( hashOptions ( image ) , image )
102
104
} ,
You can’t perform that action at this time.
0 commit comments