This commit is contained in:
Project_IO 2025-03-18 00:22:55 +09:00
parent 26fba986d7
commit 155f71eb28
2 changed files with 7 additions and 6 deletions

View file

@ -1,9 +1,10 @@
import { useEffect, useState } from "react";
import { useRaw } from "../../store/raw";
import "./fview.scss";
import { useLocation } from "react-router";
import { DynamicIcon } from "lucide-react/dynamic";
import "./fview.scss";
function FileView() {
const raw = useRaw();
const location = useLocation();

View file

@ -17,12 +17,12 @@ export const useRaw = create<RawState>((set) => ({
}
const contentType = res.headers.get("Content-Type");
if (!contentType || !contentType.includes("text")) {
set({ data: "this file is not supported showing preview" });
if (contentType && contentType.includes("text")) {
const text = await res.text();
set({ data: text });
return;
}
const text = await res.text();
set({ data: text });
set({ data: "this file is not supported showing preview" });
}
}));