json-repair 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/CLAUDE.md +1 -1
- data/lib/json/repair/version.rb +1 -1
- data/lib/json/repairer.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 288e3502829f51d11dbf2c3a9ab45f04dd44a1fa9ae5e00c1537f47c215aad96
|
|
4
|
+
data.tar.gz: 1ab99e5121ef3e73066157569bd85379a527cc1f44ecd7087d4f058133c4fcf0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffc4cd085d9a6aa5b45f3ee605a0fa043e20c68d63fdaab5c736acecbb17f160066d4412a76496300614545577d74d5ca4b232d4354adf625913753f8c0e8477
|
|
7
|
+
data.tar.gz: 190ea601a010b401fdf0c6aa52670a030ce81d39ebcd1af1f81c9fb2399baf6d074f3135b3b05814d1bcfcd24db53321a779b760c8eebe8d5a9ce2e029476754
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
### 2026-06-12 (0.11.1)
|
|
4
|
+
|
|
5
|
+
* Fix a `TypeError` crash on input ending in a lone backslash inside a
|
|
6
|
+
string: `"abc\` now repairs to `"abc"` (likewise `"\` → `""`,
|
|
7
|
+
`["abc\` → `["abc"]`, `{"a": "b\` → `{"a":"b"}`), matching upstream
|
|
8
|
+
[jsonrepair](https://github.com/josdejong/jsonrepair) v3.14.0. This
|
|
9
|
+
was a porting bug — JS `charAt` past EOF returns `''` where Ruby
|
|
10
|
+
`String#[]` returns `nil`, so the invalid-escape repair in
|
|
11
|
+
`parse_string` crashed on `str << nil` instead of ending the string,
|
|
12
|
+
violating the contract that `JSONRepairError` is the only error
|
|
13
|
+
raised. Found by differential fuzzing during the 0.11.0 review.
|
|
14
|
+
|
|
3
15
|
### 2026-06-12 (0.11.0)
|
|
4
16
|
|
|
5
17
|
* Repair object string values with unescaped quotes around a colon
|
data/CLAUDE.md
CHANGED
|
@@ -14,7 +14,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
14
14
|
- `bundle exec rake install` / `bundle exec rake release` — local install / publish to rubygems.org (release prompts for a rubygems MFA OTP).
|
|
15
15
|
- Type checking: `Steepfile` checks `lib/` against `sig/`. `bundle exec steep check` (typecheck) and `bundle exec rbs validate` (sig syntax) both run in CI and as part of the default rake task. `steep` and `rbs` are dev dependencies in the `Gemfile`.
|
|
16
16
|
|
|
17
|
-
Ruby `>= 3.0.0` is required (per gemspec). CI runs against Ruby 3.3.
|
|
17
|
+
Ruby `>= 3.0.0` is required (per gemspec). CI runs against all currently maintained Ruby branches (3.3, 3.4, 4.0).
|
|
18
18
|
|
|
19
19
|
## Architecture
|
|
20
20
|
|
data/lib/json/repair/version.rb
CHANGED
data/lib/json/repairer.rb
CHANGED
|
@@ -68,7 +68,7 @@ module JSON
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# repair redundant end quotes
|
|
71
|
-
while
|
|
71
|
+
while [CLOSING_BRACE, CLOSING_BRACKET].include?(@json[@index])
|
|
72
72
|
@index += 1
|
|
73
73
|
parse_whitespace_and_skip_comments
|
|
74
74
|
end
|
|
@@ -236,7 +236,6 @@ module JSON
|
|
|
236
236
|
|
|
237
237
|
initial = true
|
|
238
238
|
while @index < @json.length && @json[@index] != CLOSING_BRACE
|
|
239
|
-
processed_comma = true
|
|
240
239
|
if initial
|
|
241
240
|
initial = false
|
|
242
241
|
else
|
|
@@ -531,7 +530,9 @@ module JSON
|
|
|
531
530
|
return true
|
|
532
531
|
elsif @json[@index] == BACKSLASH
|
|
533
532
|
# handle escaped content like \n or ★
|
|
534
|
-
|
|
533
|
+
# nil at EOF: '' mirrors JS charAt, making the invalid-escape
|
|
534
|
+
# repair below a no-op that ends the string
|
|
535
|
+
char = @json[@index + 1] || ''
|
|
535
536
|
escape_char = ESCAPE_CHARACTERS[char]
|
|
536
537
|
if escape_char
|
|
537
538
|
str << @json[@index, 2]
|