fix(html): declare UTF-8 preview encoding (#170)

This commit is contained in:
Qiuner
2026-08-18 10:29:31 +08:00
parent 5e416eccef
commit 4d0f99ced6
2 changed files with 54 additions and 1 deletions
+1 -1
View File
@@ -695,7 +695,7 @@ export function apply(ctx: Context, config?: SidebarConfig): void {
const type = mediaTypeForPath(absolute)
const body = await readFile(absolute)
res.writeHead(200, {
'content-type': type,
'content-type': type === 'text/html' ? 'text/html; charset=utf-8' : type,
'cache-control': 'no-cache',
'x-content-type-options': 'nosniff',
'referrer-policy': 'no-referrer',