Skip to content

Commit

Permalink
fix: 🐛 customImage tags 可能为kong
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed Mar 18, 2023
1 parent 33aabb0 commit 43071d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions themes/default/components/CustomImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ const CustomImage = ({ image, width, height, fill, style }: Props) => {

// 当前图片是否为nsfw
const nsfw = useMemo(() => {
return image.tags.filter((t) => ["Hentai", "Porn", "Sexy"].includes(t.id)).map((item) => item.id);
return (image.tags || []).filter((t) => ["Hentai", "Porn", "Sexy"].includes(t.id)).map((item) => item.id);
}, [image]);

console.log(_.difference(nsfw, n));

const _style = {
...style,
filter: _.difference(nsfw, n).length > 0 ? "blur(16px)" : "inherit",
Expand Down
2 changes: 1 addition & 1 deletion themes/default/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ declare namespace EagleUse {

// 图片
export interface Image extends PrismaImage {
tags: Tag[];
tags?: Tag[];
folders: Folder[];
}

Expand Down

0 comments on commit 43071d6

Please sign in to comment.