From 7f654a1c63c48696c7d939f50badf7fe15cc0137 Mon Sep 17 00:00:00 2001 From: Mole Date: Tue, 14 May 2024 14:12:02 +0200 Subject: [PATCH] Add JsonDocumentOptions skipping comments (#16281) --- .../Configuration/JsonConfigManipulator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs index 7a07edfc7b..b294b7c021 100644 --- a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs +++ b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs @@ -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 _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) {