Skip to content

Commit

Permalink
refactor: revert secure_url to secureUrl change
Browse files Browse the repository at this point in the history
  • Loading branch information
raae committed Mar 12, 2023
1 parent 72c398b commit 5f9f78f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions demo/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function IndexPage({ data }) {
</tr>

{data.allCloudinaryMedia.nodes.map((media) => {
const { secureUrl, context } = media;
const { secure_url, context } = media;
const example1Image = getImage(media.example1ImageData);
const example2Image = getImage(media.example2ImageData);
const example3Image = getImage(media.example3ImageData);
Expand All @@ -49,7 +49,7 @@ export default function IndexPage({ data }) {
<img
width="300"
style={{ maxWidth: '100%', display: 'block' }}
src={secureUrl}
src={secure_url}
alt={alt}
/>
</td>
Expand Down Expand Up @@ -86,7 +86,7 @@ export const query = graphql`
}
allCloudinaryMedia {
nodes {
secureUrl
secure_url
gatsbyImageData(width: 300, placeholder: BLURRED)
example1ImageData: gatsbyImageData(
width: 300
Expand Down
10 changes: 7 additions & 3 deletions plugin/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const getNodeData = (gatsbyUtils, media, cloudName) => {
});

return {
// Keep all original data around,
// keep for backwards compatability.
// Remove in favour of `cloudinaryData: media`,
// when next breaking change is released
...media,
// ID
id: createNodeId(`cloudinary-media-${media.public_id}`),
// Needed by gatsby-transformer-cloudinary
cloudName: cloudName,
Expand All @@ -46,11 +51,10 @@ const getNodeData = (gatsbyUtils, media, cloudName) => {
originalFormat: media.format,
// Keep all original data around
cloudinaryData: media,
// Generate urls
// Generated urls
url: url,
secureUrl: secureUrl,
// Keep backwards capabilities
secure_url: secureUrl,
// Internal
internal: {
type: NODE_TYPE,
content: JSON.stringify(media),
Expand Down

0 comments on commit 5f9f78f

Please sign in to comment.