From 028ee831b822ae09feb75a776e567ead04fe5a62 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 19 Aug 2015 18:11:18 +0200 Subject: [PATCH] U4-6043 Error parsing package.manifest value Path line 0 position 0 #U4-6043 Fixed --- src/Umbraco.Core/Manifest/ManifestParser.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs index 571c916123..bb57e6dc6f 100644 --- a/src/Umbraco.Core/Manifest/ManifestParser.cs +++ b/src/Umbraco.Core/Manifest/ManifestParser.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -141,10 +142,16 @@ namespace Umbraco.Core.Manifest var result = new List(); foreach (var m in manifestFileContents) { - if (m.IsNullOrWhiteSpace()) continue; + // Strip byte object marker, JSON.NET does not like it + var manifestContent = m; + var preAmble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); + if (manifestContent.StartsWith(preAmble)) + manifestContent = manifestContent.Remove(0, preAmble.Length); + + if (manifestContent.IsNullOrWhiteSpace()) continue; //remove any comments first - var replaced = CommentsSurround.Replace(m, match => " "); + var replaced = CommentsSurround.Replace(manifestContent, match => " "); replaced = CommentsLine.Replace(replaced, match => ""); JObject deserialized; @@ -154,7 +161,7 @@ namespace Umbraco.Core.Manifest } catch (Exception ex) { - LogHelper.Error("An error occurred parsing manifest with contents: " + m, ex); + LogHelper.Error("An error occurred parsing manifest with contents: " + manifestContent, ex); continue; }