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 { useEffect, useState } from "react";
import { useRaw } from "../../store/raw"; import { useRaw } from "../../store/raw";
import "./fview.scss";
import { useLocation } from "react-router"; import { useLocation } from "react-router";
import { DynamicIcon } from "lucide-react/dynamic"; import { DynamicIcon } from "lucide-react/dynamic";
import "./fview.scss";
function FileView() { function FileView() {
const raw = useRaw(); const raw = useRaw();
const location = useLocation(); const location = useLocation();

View file

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