Skip to content

Commit

Permalink
PT-13653: ignore ContentFIle object from platform response (#660)
Browse files Browse the repository at this point in the history
fix: ignore ContentFIle object from platform response (#660)
  • Loading branch information
basilkot authored Oct 30, 2023
1 parent 1f50858 commit aa849a9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task<ActionResult> Feedback([FromBody] ContactForm model)

return Ok();
}

[HttpPost("slug")]
public async Task<SlugInfoResult> GetSlugInfoBySlugAsync([FromBody] SlugInfoRequest slugInfoRequest)
{
Expand Down Expand Up @@ -102,15 +102,15 @@ private async Task<SlugInfoResult> GetSlugInfoAsync(string slug, string culture)
var bestSeoInfo = seoInfos.FirstOrDefault();
result.EntityInfo = bestSeoInfo;

if (result.EntityInfo == null)
if (result.EntityInfo == null || result.EntityInfo.ObjectType == "ContentFile")
{
var pageUrl = slug == "__index__home__page__" ? "/" : $"/{slug}";
try
{
var pages = WorkContext.Pages.Where(p =>
string.Equals(p.Url, pageUrl, StringComparison.OrdinalIgnoreCase)
|| string.Equals(p.Url, slug, StringComparison.OrdinalIgnoreCase)
);
).ToList();

var page = pages.FirstOrDefault(x => x.Language.CultureName.EqualsInvariant(culture))
?? pages.FirstOrDefault(x => x.Language.IsInvariant)
Expand Down

0 comments on commit aa849a9

Please sign in to comment.