Skip to content

Conversation

yazalulloa
Copy link
Contributor

What?

Encode the cacheTag in the ImageMedia component

Why?

In the website template, media is render using the updatedAt field as a cacheTag, this value causes an InvalidQueryStringException when deploying to Cloudfront

How?

Uses encodeURIComponent on encode the date value of updatedAt

Fixes #13557

@yazalulloa yazalulloa changed the title fix(templates): encode date in imageTag - Website template fix(templates): encode date in ImageMedia - Website template Aug 22, 2025
Copy link
Contributor

@paulpopus paulpopus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes should actually be in this file templates/website/src/utilities/getMediaUrl.ts

Could you make that change please? encodeURIComponent(cacheTag) in both places there where the cacheTag is being used.
This would cover other use cases and allow the util to take care of encoding.

Also copy this over to the vercel- version of the template.

@yazalulloa
Copy link
Contributor Author

I added the changes

@paulpopus
Copy link
Contributor

Thank you! Will get this merged once CI passes

@paulpopus paulpopus enabled auto-merge (squash) September 4, 2025 17:32
@paulpopus paulpopus changed the title fix(templates): encode date in ImageMedia - Website template fix(templates): URI encode the cacheTag in getMediaUrl utility - Website template Sep 4, 2025
@paulpopus paulpopus changed the title fix(templates): URI encode the cacheTag in getMediaUrl utility - Website template fix(templates): uri encode the cacheTag in getMediaUrl utility - Website template Sep 4, 2025
@paulpopus paulpopus merged commit 008a52d into payloadcms:main Sep 4, 2025
22 of 23 checks passed
Copy link
Contributor

github-actions bot commented Sep 9, 2025

🚀 This is included in version v3.55.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Website template getMediaUrl does not encode date characters, using Cloudfront fails with InvalidQueryStringException (SST, OpenNext)
2 participants