diff options
author | 2022-10-10 15:02:20 +0200 | |
---|---|---|
committer | 2022-10-10 09:02:20 -0400 | |
commit | d7bfb144ba1718d14664ec755adf6e2281a4ab71 (patch) | |
tree | 1fe1beabedcf0926875e0b6e56ce096e205d7d0a | |
parent | b1964e9e1b7f9178036e266b89d3c8b9cbffd1c6 (diff) | |
download | astro-d7bfb144ba1718d14664ec755adf6e2281a4ab71.tar.gz astro-d7bfb144ba1718d14664ec755adf6e2281a4ab71.tar.zst astro-d7bfb144ba1718d14664ec755adf6e2281a4ab71.zip |
fixing multiple doctype injections in single file (#5035)
* fixing multiple doctype injections in single file
* adding changeset
Co-authored-by: C5341616 <C5341616@sap.com>
-rw-r--r-- | .changeset/chilly-carrots-think.md | 5 | ||||
-rw-r--r-- | packages/astro/src/runtime/server/render/page.ts | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/.changeset/chilly-carrots-think.md b/.changeset/chilly-carrots-think.md new file mode 100644 index 000000000..a90ab8715 --- /dev/null +++ b/.changeset/chilly-carrots-think.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +preventing multiple doctype injection into html documents diff --git a/packages/astro/src/runtime/server/render/page.ts b/packages/astro/src/runtime/server/render/page.ts index 7562c8563..70445ee41 100644 --- a/packages/astro/src/runtime/server/render/page.ts +++ b/packages/astro/src/runtime/server/render/page.ts @@ -30,6 +30,7 @@ async function iterableToHTMLBytes( for await (const chunk of iterable) { if (isHTMLString(chunk)) { if (i === 0) { + i++; if (!/<!doctype html/i.test(String(chunk))) { parts.append('<!DOCTYPE html>\n', result); if (onDocTypeInjection) { |