Skip to content

Commit

Permalink
Merge pull request #147 from schabibi1/fix/invalid-char-image-windows
Browse files Browse the repository at this point in the history
Fix/invalid char image windows
  • Loading branch information
schabibi1 authored Nov 4, 2022
2 parents 1c14515 + 5a4e920 commit e587e80
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ exports.onCreateNode = async (
imagePaths.forEach(async (imagePath) => {
let fileNodeID;

const mediaDataCacheKey = `sb-${imagePath}`;
const mediaDataCacheKey = `sb-${imagePath.replace(/[\/|\\|https:]/g, '')}`;
const cacheMediaData = await getCache(mediaDataCacheKey);
const isCached = cacheMediaData && node.cv === cacheMediaData.updatedAt;

Expand Down
39 changes: 39 additions & 0 deletions playground/src/pages/image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as React from "react"
import { graphql } from "gatsby"
import { GatsbyImage, getImage } from "gatsby-plugin-image"

function BlogPost({ data }) {
const image = getImage(data.file) as any
return (
<section>
<GatsbyImage image={image} alt="test" />
</section>
)
}

export default BlogPost

export const pageQuery = graphql`
query {
storyblokEntry(full_slug: { eq: "gatsby/" }) {
content
name
full_slug
uuid
id
internalId
}
file(name: {eq: "image-1"}) {
name
absolutePath
publicURL
childImageSharp {
gatsbyImageData(
width: 200
placeholder: BLURRED
formats: [AUTO, WEBP, AVIF]
)
}
}
}
`

0 comments on commit e587e80

Please sign in to comment.