Skip to content

Commit

Permalink
Merge pull request #201 from bhollis/fix-firefox-encode
Browse files Browse the repository at this point in the history
Override Firefox content type guessing
  • Loading branch information
bhollis authored May 24, 2023
2 parents e9a65d7 + 587a738 commit 0722718
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## JSONView 2.4.2

- Fix mangled encoding in Firefox

## JSONView 2.4.1

- Fix mangled arrows
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "[email protected]",
"version": "2.4.1",
"version": "2.4.2",
"name": "jsonview",
"title": "JSONView",
"description": "View JSON documents in the browser.",
Expand Down
5 changes: 3 additions & 2 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ function transformResponseToJSON(details: chrome.webRequest.WebResponseHeadersDe
let content = "";

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

filter.onstop = (_event: Event) => {
const outputDoc = `<!DOCTYPE html><html><body><pre>${content}</pre></body></html>`;
content += dec.decode();
const outputDoc = `<!DOCTYPE html><html><head><meta charset="utf-8"></head><body><pre>${content}</pre></body></html>`;
filter.write(enc.encode(outputDoc));
filter.disconnect();
};
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "JSONView",
"version": "2.4.1",
"version": "2.4.2",
"description": "__MSG_extensionDescription__",
"author": "Benjamin Hollis",
"homepage_url": "https://jsonview.com/",
Expand Down

0 comments on commit 0722718

Please sign in to comment.