diff --git a/Home/Utils/BlogPost.ts b/Home/Utils/BlogPost.ts index acf0ecd2f43..8d7811a3f82 100644 --- a/Home/Utils/BlogPost.ts +++ b/Home/Utils/BlogPost.ts @@ -317,6 +317,10 @@ export default class BlogPostUtil { const formattedPostDate: string = this.getFormattedPostDateFromFileName(fileName); + if (!(await LocalFile.doesFileExist(filePath))) { + return null; + } + let markdownContent: string = await LocalFile.read(filePath); // Resolve author WITHOUT hitting GitHub API. Use Blogs.json to get username, Authors.json for name/bio. @@ -810,7 +814,11 @@ export default class BlogPostUtil { if (!(await LocalFile.doesFileExist(filePath))) { return null; } - let markdownContent: string = await LocalFile.read(filePath); + if (!(await LocalFile.doesFileExist(filePath))) { + return null; + } + + let markdownContent: string = await LocalFile.read(filePath); if (!markdownContent || !markdownContent.trim()) { return null; }