-
Notifications
You must be signed in to change notification settings - Fork 40
fix(cdn): MERC-9364 Use CDN Original images for webdav - cache control #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1d04321
to
8a330f5
Compare
06cc938
to
a52423f
Compare
a52423f
to
46c6920
Compare
♻️ I have tested this with |
@bigcommerce/team-merchandising @bigcommerce/team-storefront |
82294e2
to
3344da0
Compare
8b8ca19
to
c9f8d6b
Compare
de37add
to
8b2e272
Compare
8b2e272
to
0483045
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
0483045
to
5944c24
Compare
🎉 Snyk checks have passed. No issues have been found so far.✅ code/snyk check is complete. No issues have been found. (View Details) |
5944c24
to
e1923c0
Compare
f766ffe
to
1e15c95
Compare
package.json
Outdated
@@ -34,7 +34,7 @@ | |||
"homepage": "https://github.com/bigcommerce/paper-handlebars", | |||
"dependencies": { | |||
"@bigcommerce/handlebars-v4": "4.7.8", | |||
"chrono-node": "^2.6.5", | |||
"chrono-node": "2.8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI. currently 2.8.1 is broken and temporary downgraded to 2.8.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to upgrade this as part of this PR? I am asking because if we need to revert it might not be straightforward PR revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, since we have to update storefront-renderer as well based on these changes , it will break it also. I guess since we won't merge it right now, later the version will be updated anyway. And we also have experiment for now, so we should be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess im also not following, why do we need the bump? your changes dont look to require this update. maybe im missing something
also i dont see how the experiment would protect you from this version bump (also missing package-lock
changes either way ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rtalvarez, it' was a blocker for running jobs. Most of them were failed due to Error: Cannot find module '../../../../src/common/abstractRefiners'
that eventually was cased by bad release of chrono-node
dependency. Similar issue can be found here. So I went to Jairo asking him how much it's critical and since we're not going to merge this branch, if we can skip it. My understanding - since we need to update SFR based on paper-handlebars changes, probably dependencies will be reinstalled under the hood with broken version of chrono-node
anyway. cc @jairo-bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in terms of experiment I only mean that we simply can turn it off, if something is broken and SFR would use original version of handlebars.
package-lock
is under gitignore and i don't see it in the project structure as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bc-alexsaiannyi feel free to merge master into your branch, this change is already there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, thanks!
1e15c95
to
397d05d
Compare
What? Why?
! DO NOT MERGE !
Use CDN Original images for webdav - cache control. Take 2. See bigcommerce/paper#343
If a developer/merchant uses the cdn handlebars helper to inject images from webdav into the theme using e.g.
({{cdn "webdav:/img/image.jpg"}})
, there is no cache-control header when the image is fetched on the storefront.Similar to our Image Manager, we should be using the cdn original images (Similar to Jinsoo's PR here MERC-7127)
This PR differs from the previous as it only does this for file suffixes that image manager supports (jpg/jpeg/png/gif). This avoids the issue where the url is changed for e.g. a pdf, and thus creates a broken link.
How was it tested?
Tested locally and in integration, and with unit tests. Have verified that images (png/gif/jpeg/jpg) uploaded to the content directory via webdav can be accessed at their cache-controlled url using the
cdn
helper (/images/stencil/original/content/<whatever>
), while all other file extensions still return the/content/<whatever>
path when using the helper.Behold, the results of outputting some of these urls directly to the DOM:

cc @bigcommerce/storefront-team