From 32c0ca36efdb2dca1b6cbc6cbd8200b24d16a044 Mon Sep 17 00:00:00 2001 From: Armored Dragon Date: Fri, 22 Mar 2024 07:30:12 -0500 Subject: [PATCH] Author page exception fix Signed-off-by: Armored Dragon --- backend/core/core.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/core/core.js b/backend/core/core.js index 3094502..d75f32f 100644 --- a/backend/core/core.js +++ b/backend/core/core.js @@ -113,16 +113,14 @@ async function getBlog({ id, visibility = "PUBLISHED", owner_id, limit = 10, pag AND: [ { - OR: [ - - ] - } + OR: [], + }, ], }; // Build the "where_object" object - if (search){ - if (search_tags) where_object["AND"][0]["OR"].push({ tags: { hasSome: [search?.toLowerCase()] }}); + if (search) { + if (search_tags) where_object["AND"][0]["OR"].push({ tags: { hasSome: [search?.toLowerCase()] } }); if (search_title) where_object["AND"][0]["OR"].push({ title: { contains: search, mode: "insensitive" } }); if (search_content) where_object["AND"][0]["OR"].push({ content: { contains: search, mode: "insensitive" } }); } @@ -391,11 +389,13 @@ async function _renderPost(blog_post, raw, { post_type = "blog" } = {}) { // get thumbnail URL blog_post.thumbnail = await _getImage(blog_post.id, post_type, blog_post.thumbnail); - // Render the markdown contents of the post - blog_post.content = md.render(blog_post.content); + if (blog_post.content) { + // Render the markdown contents of the post + blog_post.content = md.render(blog_post.content); - // Replace custom formatting with what we want - blog_post.content = _format_blog_content(blog_post.content, blog_post.images); + // Replace custom formatting with what we want + blog_post.content = _format_blog_content(blog_post.content, blog_post.images); + } return blog_post; }