fix(app): binary file handling in file view (#11312)

This commit is contained in:
Alex Yaroshuk
2026-02-01 23:40:33 +08:00
committed by GitHub
parent b51005ec4a
commit 23c803707d
19 changed files with 221 additions and 24 deletions

View File

@@ -2342,6 +2342,7 @@ export default function Page() {
const c = state()?.content
return c?.mimeType === "image/svg+xml"
})
const isBinary = createMemo(() => state()?.content?.type === "binary")
const svgContent = createMemo(() => {
if (!isSvg()) return
const c = state()?.content
@@ -2794,6 +2795,19 @@ export default function Page() {
</Show>
</div>
</Match>
<Match when={state()?.loaded && isBinary()}>
<div class="h-full px-6 pb-42 flex flex-col items-center justify-center text-center gap-6">
<Mark class="w-14 opacity-10" />
<div class="flex flex-col gap-2 max-w-md">
<div class="text-14-semibold text-text-strong truncate">
{path()?.split("/").pop()}
</div>
<div class="text-14-regular text-text-weak">
{language.t("session.files.binaryContent")}
</div>
</div>
</div>
</Match>
<Match when={state()?.loaded}>{renderCode(contents(), "pb-40")}</Match>
<Match when={state()?.loading}>
<div class="px-6 py-4 text-text-weak">{language.t("common.loading")}...</div>