diff --git a/Apps.Shopify/Apps.Shopify.csproj b/Apps.Shopify/Apps.Shopify.csproj index 253f8c2..68a43c6 100644 --- a/Apps.Shopify/Apps.Shopify.csproj +++ b/Apps.Shopify/Apps.Shopify.csproj @@ -6,14 +6,14 @@ enable Shopify E-commerce platform that enables individuals and businesses to create and manage online stores. - 1.5.7 + 1.5.8 Apps.Shopify - + - + diff --git a/Apps.Shopify/HtmlConversion/ShopifyHtmlConverter.cs b/Apps.Shopify/HtmlConversion/ShopifyHtmlConverter.cs index 3901c3f..2c3a173 100644 --- a/Apps.Shopify/HtmlConversion/ShopifyHtmlConverter.cs +++ b/Apps.Shopify/HtmlConversion/ShopifyHtmlConverter.cs @@ -4,6 +4,7 @@ using Apps.Shopify.Models.Dto; using Apps.Shopify.Models.Entities; using Apps.Shopify.Models.Request.TranslatableResource; +using Blackbird.Applications.Sdk.Common.Exceptions; using HtmlAgilityPack; namespace Apps.Shopify.HtmlConversion; @@ -156,6 +157,9 @@ public static ProductTranslatableResourceDto ProductToJson(string file, string l var productContentNodes = doc.DocumentNode.Descendants() .Where(x => x.Attributes[KeyAttr]?.Value != null && x.ParentNode.Name == "body"); + if (!productContentNodes.Any()) + throw new PluginMisconfigurationException("Invalid product HTML: no product nodes with 'key' attribute found."); + var metafieldContentNodes = doc.DocumentNode.Descendants() .FirstOrDefault(x => x.Attributes[TypeAttr]?.Value == MetafieldType)? .ChildNodes.Where(x => x.Attributes[KeyAttr]?.Value != null);