Skip to content

Commit 587a738

Browse files
committed
Override Firefox content type guessing
1 parent e9a65d7 commit 587a738

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## JSONView 2.4.2
2+
3+
- Fix mangled encoding in Firefox
4+
15
## JSONView 2.4.1
26

37
- Fix mangled arrows

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
3-
"version": "2.4.1",
3+
"version": "2.4.2",
44
"name": "jsonview",
55
"title": "JSONView",
66
"description": "View JSON documents in the browser.",

src/background.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ function transformResponseToJSON(details: chrome.webRequest.WebResponseHeadersDe
3030
let content = "";
3131

3232
filter.ondata = (event) => {
33-
content = content + dec.decode(event.data);
33+
content += dec.decode(event.data, { stream: true });
3434
};
3535

3636
filter.onstop = (_event: Event) => {
37-
const outputDoc = `<!DOCTYPE html><html><body><pre>${content}</pre></body></html>`;
37+
content += dec.decode();
38+
const outputDoc = `<!DOCTYPE html><html><head><meta charset="utf-8"></head><body><pre>${content}</pre></body></html>`;
3839
filter.write(enc.encode(outputDoc));
3940
filter.disconnect();
4041
};

src/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "JSONView",
4-
"version": "2.4.1",
4+
"version": "2.4.2",
55
"description": "__MSG_extensionDescription__",
66
"author": "Benjamin Hollis",
77
"homepage_url": "https://jsonview.com/",

0 commit comments

Comments
 (0)