diff --git a/src/pages/home/file/File.tsx b/src/pages/home/file/File.tsx index b5f2e40f0..83f578086 100644 --- a/src/pages/home/file/File.tsx +++ b/src/pages/home/file/File.tsx @@ -1,7 +1,7 @@ import { HStack, VStack } from "@hope-ui/solid" -import { createMemo, Show, Suspense } from "solid-js" +import { createMemo, ErrorBoundary, Show, Suspense } from "solid-js" import { Dynamic } from "solid-js/web" -import { FullLoading, SelectWrapper } from "~/components" +import { Error, FullLoading, SelectWrapper } from "~/components" import { objStore } from "~/store" import { useRouter } from "~/hooks" import { Download } from "../previews/download" @@ -38,9 +38,11 @@ const File = () => { /> - }> - - + }> + }> + + + ) diff --git a/src/pages/home/previews/url.tsx b/src/pages/home/previews/url.tsx index 79dec018b..6c85378c2 100644 --- a/src/pages/home/previews/url.tsx +++ b/src/pages/home/previews/url.tsx @@ -9,18 +9,18 @@ import { createMemo } from "solid-js" export default function () { const [content] = useFetchText() const { copy } = useUtil() + const t = useT() const url = createMemo(() => { - try { - const ini = content()?.content || "" - const { text } = useParseText(ini) - const config = recordKeysToLowerCase(parse(text() || "")) - return config.internetshortcut?.url || "#" - } catch (error) { - console.error("Error parsing INI content:", error) - return "#" - } + if (content.loading) return "" + const ini = content()?.content + if (!ini) throw new Error("No content") + if (typeof ini === "string") throw new Error(ini) + const { text } = useParseText(ini) + const config = recordKeysToLowerCase(parse(text() || "")) + const shortcutUrl = config.internetshortcut?.url + if (!shortcutUrl) throw new Error("Invalid .url file: no URL found") + return shortcutUrl }) - const t = useT() return (