Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

added HTML encoding for the Bundled product item name. (#370)

Nikhil Scaria706de6d8bc9e
diff --git a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
index f362a4f96..ce47258d7 100644
--- a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
@@ -94,6 +94,10 @@ namespace Grand.Business.Catalog.Services.Products
if (product.ProductTypeId == ProductType.BundledProduct)
{
var i = 0;
+ if (result.Length > 0)
+ {
+ result.Append(separator);
+ }
foreach (var bundle in product.BundleProducts)
{
var p1 = await _productService.GetProductById(bundle.ProductId);
@@ -101,7 +105,14 @@ namespace Grand.Business.Catalog.Services.Products
if (i > 0)
result.Append(separator);
- result.Append($"<a href=\"{p1.GetSeName(langId)}\"> {p1.GetTranslation(x => x.Name, langId)} </a>");
+ if (htmlEncode)
+ {
+ result.Append($"<a href=\"{p1.GetSeName(langId)}\"> {WebUtility.HtmlEncode(p1.GetTranslation(x => x.Name, langId))} </a>");
+ }
+ else
+ {
+ result.Append($"<a href=\"{p1.GetSeName(langId)}\"> {p1.GetTranslation(x => x.Name, langId)} </a>");
+ }
var formattedAttribute = await PrepareFormattedAttribute(p1, customAttributes, langId, separator, htmlEncode,
renderPrices, allowHyperlinks, showInAdmin);
if (formattedAttribute.Length > 0)