From eac3df770e4d5944485f0b9b08b155533391a76c Mon Sep 17 00:00:00 2001 From: Bruno Parmentier Date: Thu, 11 Aug 2022 11:50:07 +0200 Subject: [PATCH] fix: encoding issue in CDN responses When downloading the redoc JS from redoc.ly CDN (e.g. https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js) the Content-Type header in the response is missing 'charset=utf-8', causing the file to be displayed with garbled characters. --- scripts/publish-cdn.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/publish-cdn.sh b/scripts/publish-cdn.sh index db5b0dcd19..b9c1192a40 100755 --- a/scripts/publish-cdn.sh +++ b/scripts/publish-cdn.sh @@ -8,7 +8,9 @@ VERSION=$(node scripts/version.js) VERSION_TAG=v${VERSION:0:1}.x copy_to_s3 () { - aws s3 cp bundles "s3://redocly-cdn/redoc/$1/bundles" --recursive + aws s3 cp --exclude "*" --include "*.js" --content-type "application/javascript; charset=utf-8" bundles "s3://redocly-cdn/redoc/$1/bundles" --recursive + aws s3 cp --exclude "*" --include "*.map" --content-type "application/json" bundles "s3://redocly-cdn/redoc/$1/bundles" --recursive + aws s3 cp --exclude "*" --include "*.txt" bundles "s3://redocly-cdn/redoc/$1/bundles" --recursive aws s3 cp CHANGELOG.md "s3://redocly-cdn/redoc/$1/CHANGELOG.md" aws s3 cp LICENSE "s3://redocly-cdn/redoc/$1/LICENSE" aws s3 cp package.json "s3://redocly-cdn/redoc/$1/package.json"