Skip to content

Commit

Permalink
#7221 #6568 Added some data encoding into JSON-LD
Browse files Browse the repository at this point in the history
  • Loading branch information
skoshelev committed Jun 10, 2024
1 parent 8997bbc commit 13f3d2f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Presentation/Nop.Web/Factories/JsonLdModelFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Globalization;
using System.Text.Encodings.Web;
using Nop.Core;
using Nop.Core.Domain.Catalog;
using Nop.Core.Events;
Expand Down Expand Up @@ -161,13 +162,13 @@ public virtual async Task<JsonLdProductModel> PrepareJsonLdProductAsync(ProductD

product.Review = model.ProductReviews.Items?.Select(review => new JsonLdReviewModel
{
Name = review.Title,
ReviewBody = review.ReviewText,
Name = JavaScriptEncoder.Default.Encode(review.Title),
ReviewBody = JavaScriptEncoder.Default.Encode(review.ReviewText),
ReviewRating = new JsonLdRatingModel
{
RatingValue = review.Rating
},
Author = new JsonLdPersonModel { Name = review.CustomerName },
Author = new JsonLdPersonModel { Name = JavaScriptEncoder.Default.Encode(review.CustomerName) },
DatePublished = review.WrittenOnStr
}).ToList();
}
Expand Down

0 comments on commit 13f3d2f

Please sign in to comment.