Open christensenep opened 8 months ago
♻️ I have tested this with gif
s, jpeg/jpg
s and png
s, and verified that the new urls are valid and have cache control headers. I have also verified that other file extensions such as pdf
s and, importantly, bmp
s do not change the url from its current form and are thus still valid. I also verified that bmp
s do not have the images/stencil/content
form of the url available, so I believe this is the correct and exhaustive of extensions we should be doing this for.
@bigcommerce/team-merchandising @bigcommerce/team-storefront
What? Why?
Use CDN Original images for webdav - cache control. Take 2. See https://github.com/bigcommerce/paper/pull/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