Skip to content

Commit 7f654a1

Browse files
Add JsonDocumentOptions skipping comments (#16281)
1 parent 6a9f936 commit 7f654a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ internal class JsonConfigManipulator : IConfigManipulator
1919
private const string GlobalIdPath = $"{CmsObjectPath}:Global:Id";
2020
private const string DisableRedirectUrlTrackingPath = $"{CmsObjectPath}:WebRouting:DisableRedirectUrlTracking";
2121

22+
private readonly JsonDocumentOptions _jsonDocumentOptions = new() { CommentHandling = JsonCommentHandling.Skip };
2223
private readonly IConfiguration _configuration;
2324
private readonly ILogger<JsonConfigManipulator> _logger;
2425
private readonly SemaphoreSlim _lock = new(1, 1);
@@ -238,7 +239,7 @@ private async Task SaveJsonAsync(JsonConfigurationProvider? provider, JsonNode j
238239
try
239240
{
240241
using var streamReader = new StreamReader(jsonFilePath);
241-
return await JsonNode.ParseAsync(streamReader.BaseStream);
242+
return await JsonNode.ParseAsync(streamReader.BaseStream, documentOptions: _jsonDocumentOptions);
242243
}
243244
catch (IOException exception)
244245
{

0 commit comments

Comments
 (0)