파일 업로드에 성공한 경우 캐시에도 파일을 저장하도록 개선

This commit is contained in:
static
2025-01-25 01:16:02 +09:00
parent a01137bbf9
commit cdbe5594f9
8 changed files with 34 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
import { callGetApi, callPostApi } from "$lib/hooks";
import { storeHmacSecrets } from "$lib/indexedDB";
import { generateDataKey, wrapDataKey, unwrapHmacSecret, encryptString } from "$lib/modules/crypto";
import { deleteFileCache, uploadFile } from "$lib/modules/file";
import { storeFileCache, deleteFileCache, uploadFile } from "$lib/modules/file";
import type {
DirectoryRenameRequest,
DirectoryCreateRequest,
@@ -63,7 +63,11 @@ export const requestFileUpload = async (
masterKey: MasterKey,
onDuplicate: () => Promise<boolean>,
) => {
return await uploadFile(file, parentId, hmacSecret, masterKey, onDuplicate);
const res = await uploadFile(file, parentId, hmacSecret, masterKey, onDuplicate);
if (!res) return false;
storeFileCache(res.fileId, res.fileBuffer); // Intended
return true;
};
export const requestDirectoryEntryRename = async (