diff --git a/src/features/gallery/GalleryImg.tsx b/src/features/gallery/GalleryImg.tsx index cb2450a2b7..c07ef4c27e 100644 --- a/src/features/gallery/GalleryImg.tsx +++ b/src/features/gallery/GalleryImg.tsx @@ -3,8 +3,8 @@ import "photoswipe/dist/photoswipe.css"; import { PostView } from "lemmy-js-client"; import { GalleryContext } from "./GalleryProvider"; import { PreparedPhotoSwipeOptions } from "photoswipe"; -import mime from "mime"; import Video from "../shared/Video"; +import { isUrlVideo } from "../../helpers/lemmy"; export interface GalleryImgProps { src?: string; @@ -35,11 +35,7 @@ export function GalleryImg({ const imgRef = useRef(null); const { open } = useContext(GalleryContext); - const mt = mime.getType(`${src}`); - - const isVideo = mt?.startsWith("video/"); - - const InnerComponent = !isVideo ? ( + return !isUrlVideo(`${src}`) ? ( ); - - return InnerComponent; }