Skip to content

Commit

Permalink
fix: build error that occurs when there is bad data in the explore fo…
Browse files Browse the repository at this point in the history
…lder
  • Loading branch information
hiporox committed Jul 24, 2024
1 parent f2f10d6 commit 6567b4f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/common/data/explore/loadExploreMarkdown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import matter from "gray-matter";
import supabaseClient from "../database/supabase/clients/server";
import { isNull, map } from "lodash";
import { endsWith, filter, isNull, map, startsWith } from "lodash";

type MatterResultData = {
title: string;
Expand Down Expand Up @@ -50,6 +50,9 @@ export async function getAllSlugs() {
if (isNull(data)) {
return [];
}
return map(data, (d) => d.name.replace(/\.md$/, ""));
return map(
filter(data, (d) => endsWith(d.name, ".md") && !startsWith(d.name, ".")),
(d) => d.name.replace(/\.md$/, ""),
);
}
}

0 comments on commit 6567b4f

Please sign in to comment.