Skip to content

Commit a990c75

Browse files
committed
2 parents c4e2640 + 2369923 commit a990c75

5 files changed

Lines changed: 28 additions & 4 deletions

File tree

.github/workflows/pull-requests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
dotnet-version: 8.0.400
2020
- name: Cache NuGet packages
21-
uses: actions/cache@v4
21+
uses: actions/cache@v5
2222
with:
2323
path: ~/.nuget/packages
2424
key: ${{ runner.os }}-nuget-${{ hashFiles('**/paket.lock') }}
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
dotnet-version: 8.0.400
4646
- name: Cache NuGet packages
47-
uses: actions/cache@v4
47+
uses: actions/cache@v5
4848
with:
4949
path: ~/.nuget/packages
5050
key: ${{ runner.os }}-nuget-${{ hashFiles('**/paket.lock') }}

.github/workflows/push-master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
dotnet-version: 8.0.400
2424
- name: Cache NuGet packages
25-
uses: actions/cache@v4
25+
uses: actions/cache@v5
2626
with:
2727
path: ~/.nuget/packages
2828
key: ${{ runner.os }}-nuget-${{ hashFiles('**/paket.lock') }}

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## 8.1.3 - Mar 23 2026
4+
5+
- Fix JSON `/* ... */` comment parser: `*` or `/` characters inside the comment body no longer cause premature termination and parse failure
6+
37
## 8.1.2 - Mar 17 2026
48

59
- Fix `TextConversions.AsDateTime` and `TextConversions.AsDateTimeOffset` to return `None` (instead of throwing `ArgumentOutOfRangeException`) when a `/Date(...)/` value overflows the valid `DateTime`/`DateTimeOffset` range; use `InvariantCulture` explicitly when parsing the milliseconds value

src/FSharp.Data.Json.Core/JsonValue.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ type private JsonParser(jsonText: string) =
273273
else if i < s.Length && s.[i] = '*' then
274274
i <- i + 1
275275

276-
while i + 1 < s.Length && s.[i] <> '*' && s.[i + 1] <> '/' do
276+
while i + 1 < s.Length && (s.[i] <> '*' || s.[i + 1] <> '/') do
277277
i <- i + 1
278278

279279
ensure (i + 1 < s.Length && s.[i] = '*' && s.[i + 1] = '/')

tests/FSharp.Data.Core.Tests/JsonValue.fs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,26 @@ let ``JsonValue parsing with multi-line comments`` () =
602602
let result = JsonValue.Parse jsonWithComments
603603
result?data.AsString() |> should equal "valid"
604604

605+
[<Test>]
606+
let ``JsonValue parsing with multi-line comment containing asterisk`` () =
607+
// Bug: old code used '&&' so a '*' anywhere inside stopped scanning too early
608+
let json = """{ /* a * b */ "x": 1 }"""
609+
let result = JsonValue.Parse json
610+
result?x.AsInteger() |> should equal 1
611+
612+
[<Test>]
613+
let ``JsonValue parsing with multi-line comment containing slash`` () =
614+
// Bug: old code used '&&' so a '/' anywhere inside stopped scanning too early
615+
let json = """{ /* path/to/file */ "x": 2 }"""
616+
let result = JsonValue.Parse json
617+
result?x.AsInteger() |> should equal 2
618+
619+
[<Test>]
620+
let ``JsonValue parsing with multi-line comment containing both asterisk and slash`` () =
621+
let json = "{ /* a/b * c */ \"x\": 3 }"
622+
let result = JsonValue.Parse json
623+
result?x.AsInteger() |> should equal 3
624+
605625
[<Test>]
606626
let ``JsonValue parsing with mixed whitespace and comments`` () =
607627
let jsonWithCommentsAndWhitespace = """

0 commit comments

Comments
 (0)