fix
This commit is contained in:
parent
26fba986d7
commit
155f71eb28
2 changed files with 7 additions and 6 deletions
|
@ -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();
|
||||
|
|
|
@ -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" });
|
||||
}
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue