diff --git a/src/routes/(fullscreen)/file/[id]/+page.svelte b/src/routes/(fullscreen)/file/[id]/+page.svelte
index 51d7e21..c5e822e 100644
--- a/src/routes/(fullscreen)/file/[id]/+page.svelte
+++ b/src/routes/(fullscreen)/file/[id]/+page.svelte
@@ -32,24 +32,22 @@
untrack(() => {
isDownloaded = true;
+ if ($info.contentType.startsWith("image")) {
+ contentType = "image";
+ } else if ($info.contentType.startsWith("video")) {
+ contentType = "video";
+ }
+
requestFileDownload(data.id, $info.contentIv, $info.dataKey).then(async (res) => {
content = new Blob([res], { type: $info.contentType });
if (content.type === "image/heic" || content.type === "image/heif") {
contentUrl = URL.createObjectURL(
(await heic2any({ blob: content, toType: "image/jpeg" })) as Blob,
);
- } else {
+ } else if (contentType) {
contentUrl = URL.createObjectURL(content);
- }
-
- if (content.type.startsWith("image")) {
- contentType = "image";
- } else if (content.type.startsWith("video")) {
- contentType = "video";
- }
-
- if (!contentType) {
- FileSaver.saveAs(new Blob([res], { type: $info.contentType }), $info.name);
+ } else {
+ FileSaver.saveAs(content, $info.name);
}
});
});
@@ -80,18 +78,16 @@
{/snippet}
- {#if contentType === "image"}
- {#if $info && content}
- {@const src = URL.createObjectURL(new Blob([content], { type: $info.contentType }))}
-
+ {#if $info && contentType === "image"}
+ {#if contentUrl}
+
{:else}
{@render viewerLoading("이미지를 불러오고 있어요.")}
{/if}
{:else if contentType === "video"}
- {#if $info && content}
- {@const src = URL.createObjectURL(new Blob([content], { type: $info.contentType }))}
+ {#if contentUrl}
-
+
{:else}
{@render viewerLoading("비디오를 불러오고 있어요.")}
{/if}