Skip to content

Commit

Permalink
Add html decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
DSPaul committed Feb 16, 2025
1 parent 4934364 commit f672ee4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ViewModels/Sources/GenericOnlineSourceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using HtmlAgilityPack;
using System;
using System.Diagnostics;
using System.Net;
using System.Threading.Tasks;

namespace COMPASS.ViewModels.Sources
Expand Down Expand Up @@ -36,17 +37,17 @@ public override async Task<CodexDto> GetMetaData(SourceSet sources)
CodexDto codex = new();

// Title
codex.Title = src.SelectSingleNode("//meta[@property='og:title']")?.GetAttributeValue("content", null) ?? codex.Title;
codex.Title = WebUtility.HtmlDecode(src.SelectSingleNode("//meta[@property='og:title']")?.GetAttributeValue("content", null) ?? codex.Title);

// Authors
string? author = src.SelectSingleNode("//meta[@property='og:author']")?.GetAttributeValue("content", String.Empty);
string? author = WebUtility.HtmlDecode(src.SelectSingleNode("//meta[@property='og:author']")?.GetAttributeValue("content", String.Empty));
if (!String.IsNullOrEmpty(author))
{
codex.Authors = new() { author };
}

// Description
codex.Description = src.SelectSingleNode("//meta[@property='og:description']")?.GetAttributeValue("content", null) ?? codex.Description;
codex.Description = WebUtility.HtmlDecode(src.SelectSingleNode("//meta[@property='og:description']")?.GetAttributeValue("content", null) ?? codex.Description);

// Tags
foreach (var folderTagPair in TargetCollection.Info.FolderTagPairs)
Expand Down

0 comments on commit f672ee4

Please sign in to comment.