mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 22:01:49 +03:00
Added Access-Control-Allow-Origin: *
to image assets (#17115)
refs https://ghost.slack.com/archives/C025584CA/p1687506966658799 refs https://ghost.slack.com/archives/C04TMVA1D7A/p1687426009256949 This change is required because we otherwise hit CORS issues when admin tries to load an image and calculate the average color (to determine the text color).
This commit is contained in:
parent
55b7bef9ad
commit
018f97e679
@ -46,6 +46,8 @@ function createPublicFileMiddleware(location, file, mime, maxAge) {
|
||||
|
||||
// send image files directly and let express handle content-length, etag, etc
|
||||
if (mime.match(/^image/)) {
|
||||
// In admin we need to read images and calculate the average color (blocked by CORS otherwise)
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
return res.sendFile(filePath, (err) => {
|
||||
if (err && err.status === 404) {
|
||||
// ensure we're triggering basic asset 404 and not a templated 404
|
||||
|
Loading…
Reference in New Issue
Block a user