From 7b22ab98ac0af2f353fe67c4ae989eecbdf7bd36 Mon Sep 17 00:00:00 2001 From: Adam Schwartz Date: Fri, 5 Jun 2020 15:21:32 -0400 Subject: [PATCH] cleanup re https://git.io/Jf1ap --- workers-site/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/workers-site/index.js b/workers-site/index.js index 13d40066..e5078352 100644 --- a/workers-site/index.js +++ b/workers-site/index.js @@ -86,8 +86,9 @@ async function handleEvent(event) { // // Manually adding utf8 charset for now since kv-asset-handler // has it fixed (https://git.io/Jf1aQ) but it's not yet in a release - if (response.headers.get('content-type').startsWith('text')) { - response.headers.set('content-type', response.headers.get('content-type') + '; charset=utf8') + const contentType = response.headers.get('content-type') + if (contentType.startsWith('text')) { + response.headers.set('content-type', contentType + '; charset=utf8') } if (url.pathname === '/' || url.pathname === '/index.html') {