Fix: Image files displaying as normal files
This commit is contained in:
parent
bf61c339e1
commit
44fbc4ebdc
2 changed files with 6 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ import DownloadButton from "./components/downloadButton/downloadButton";
|
|||
import getClasses from "./utils/get-classes";
|
||||
import handleDownload from "./utils/handle-download";
|
||||
|
||||
const imgTypes = new Set(["png", "jpg"]);
|
||||
const imgTypes = new Set(["png", "jpg", "jpeg", "gif", "webp", "image"]);
|
||||
|
||||
export default function FileCard({
|
||||
fileName,
|
||||
|
|
@ -29,7 +29,7 @@ export default function FileCard({
|
|||
|
||||
const imgSrc = `${BACKEND_URL.slice(
|
||||
0,
|
||||
BACKEND_URL.length - 1
|
||||
BACKEND_URL.length - 1,
|
||||
)}${BASE_URL_API}files/images/${content}`;
|
||||
|
||||
if (showFile) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import IconComponent, {
|
|||
import { Skeleton } from "../../../../../components/ui/skeleton";
|
||||
import formatFileName from "./utils/format-file-name";
|
||||
|
||||
const supImgFiles = ["png", "jpg", "jpeg", "gif", "bmp", "webp", "image"];
|
||||
|
||||
export default function FilePreview({
|
||||
error,
|
||||
file,
|
||||
|
|
@ -16,7 +18,8 @@ export default function FilePreview({
|
|||
error: boolean;
|
||||
onDelete: () => void;
|
||||
}) {
|
||||
const isImage = file.type.toLowerCase().includes("image");
|
||||
const fileType = file.type.toLowerCase();
|
||||
const isImage = supImgFiles.some((type) => fileType.includes(type));
|
||||
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue