fix(mac): render Canvas HTML correctly

This commit is contained in:
Peter Steinberger
2025-12-12 20:01:12 +00:00
parent 27a7d9f9d1
commit 4ecd35c275
2 changed files with 19 additions and 8 deletions

View File

@@ -20,10 +20,12 @@ enum CanvasScheme {
static func mimeType(forExtension ext: String) -> String {
switch ext.lowercased() {
case "html", "htm": "text/html; charset=utf-8"
case "js", "mjs": "application/javascript; charset=utf-8"
case "css": "text/css; charset=utf-8"
case "json", "map": "application/json; charset=utf-8"
// Note: WKURLSchemeHandler uses URLResponse(mimeType:), which expects a bare MIME type
// (no `; charset=...`). Encoding is provided via URLResponse(textEncodingName:).
case "html", "htm": "text/html"
case "js", "mjs": "application/javascript"
case "css": "text/css"
case "json", "map": "application/json"
case "svg": "image/svg+xml"
case "png": "image/png"
case "jpg", "jpeg": "image/jpeg"
@@ -37,4 +39,3 @@ enum CanvasScheme {
}
}
}