From b9bb6c9b24d5c35a57ad57a803b9398e82ffa17c Mon Sep 17 00:00:00 2001 From: Louis Escher <66965600+louisescher@users.noreply.github.com> Date: Mon, 23 Dec 2024 01:27:58 +0100 Subject: [PATCH] Fix server island script breaking when charset is added to content-type --- packages/astro/src/runtime/server/render/server-islands.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/runtime/server/render/server-islands.ts b/packages/astro/src/runtime/server/render/server-islands.ts index 97bf1d3314e5..7059218287c8 100644 --- a/packages/astro/src/runtime/server/render/server-islands.ts +++ b/packages/astro/src/runtime/server/render/server-islands.ts @@ -120,7 +120,10 @@ let response = await fetch('${serverIslandUrl}', { ` } if (script) { - if(response.status === 200 && response.headers.get('content-type') === 'text/html') { + if( + response.status === 200 + && response.headers.has('content-type') + && response.headers.get('content-type').split(";")[0].trim() === 'text/html') { let html = await response.text(); // Swap!