Add JsonDocumentOptions skipping comments (#16281)

This commit is contained in:
Mole
2024-05-14 14:12:02 +02:00
committed by GitHub
parent 6a9f936cce
commit 7f654a1c63

View File

@@ -19,6 +19,7 @@ internal class JsonConfigManipulator : IConfigManipulator
private const string GlobalIdPath = $"{CmsObjectPath}:Global:Id";
private const string DisableRedirectUrlTrackingPath = $"{CmsObjectPath}:WebRouting:DisableRedirectUrlTracking";
private readonly JsonDocumentOptions _jsonDocumentOptions = new() { CommentHandling = JsonCommentHandling.Skip };
private readonly IConfiguration _configuration;
private readonly ILogger<JsonConfigManipulator> _logger;
private readonly SemaphoreSlim _lock = new(1, 1);
@@ -238,7 +239,7 @@ internal class JsonConfigManipulator : IConfigManipulator
try
{
using var streamReader = new StreamReader(jsonFilePath);
return await JsonNode.ParseAsync(streamReader.BaseStream);
return await JsonNode.ParseAsync(streamReader.BaseStream, documentOptions: _jsonDocumentOptions);
}
catch (IOException exception)
{