chore: update image checks (#2092)

This commit is contained in:
boojack
2023-08-06 10:38:39 +08:00
committed by GitHub
parent 5d5d8de9fe
commit 726300394b
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import classNames from "classnames";
import { getResourceUrl } from "@/utils/resource";
import { getResourceType, getResourceUrl } from "@/utils/resource";
import Icon from "./Icon";
import showPreviewImageDialog from "./PreviewImageDialog";
import SquareDiv from "./kit/SquareDiv";
@ -12,7 +12,7 @@ interface Props {
const ResourceIcon = (props: Props) => {
const { className, resource } = props;
if (resource.type.includes("image")) {
if (getResourceType(resource).startsWith("image")) {
const url = getResourceUrl(resource);
return (
<SquareDiv key={resource.id} className={classNames("cursor-pointer rounded hover:shadow", className)}>