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

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

@@ -63,7 +63,7 @@ export const registerUserClient = async (
}
try {
const { clientId } = await createClient(encPubKey, sigPubKey, userId);
const { id: clientId } = await createClient(encPubKey, sigPubKey, userId);
return { challenge: await createUserClientChallenge(ip, userId, clientId, encPubKey) };
} catch (e) {
if (e instanceof IntegrityError && e.message === "Public key(s) already registered") {

View File

@@ -131,11 +131,12 @@ export const uploadFile = async (
throw new Error("Invalid checksum");
}
await registerFile({
const { id: fileId } = await registerFile({
...params,
path,
encContentHash: hash,
});
return { fileId };
} catch (e) {
await safeUnlink(path);