Skip to content

Commit

Permalink
Tweak quote finder regex to fix #138.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhollis committed Jan 8, 2017
1 parent a92f048 commit de15259
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
JSONView 1.2.1
---
* Fixed a case where JSON would fail to parse if a string contains a number and the JSON isn't indented.

JSONView 1.2.0
---
* Add a preference to use the built-in Firefox JSON viewer.
Expand Down
2 changes: 1 addition & 1 deletion lib/jsonview.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var JSONView = Class({

// Find unescaped quotes by searching for a non-backslash followed by 0 or even
// pairs of backslashes, then a quote
var quoteFinder = /([^\\]|^)(\\\\)*(?=")/gm;
var quoteFinder = /[^\\\n\r]*?(\\\\)*"/gm;

// This has some memory of what its last state was
var wasInQuotes = false;
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": "1.2.0",
"version": "1.2.1",
"name": "jsonview",
"title": "JSONView",
"description": "View JSON documents in the browser.",
Expand Down
3 changes: 3 additions & 0 deletions tests/issue138.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"i18n":"label"
}
6 changes: 6 additions & 0 deletions tests/issue21b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tags": [
""
],
"id-shouldEndWith664": 336541846568177664
}
3 changes: 3 additions & 0 deletions tests/issue21c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"":"18"
}

0 comments on commit de15259

Please sign in to comment.