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 { 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();
|
||||||
|
|
|
@ -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 });
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue