Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
fix(activity): checksum fail due to duplicate files
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdcruz committed Nov 21, 2024
1 parent 415417c commit e708388
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/libs/supabase/api/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,19 @@ export async function uploadActivityFiles(
});
} else {
// store metadata to 'activity_files' table
await supabase.from('activity_files').insert({
activity: activityId,
name: file.name,
checksum: bytesToHex(hash),
encrypted_checksum: bytesToHex(encryptedHash),
type: file.type,
key: bytesToHex(key),
});
await supabase.from('activity_files').upsert(
{
activity: activityId,
name: file.name,
checksum: bytesToHex(hash),
encrypted_checksum: bytesToHex(encryptedHash),
type: file.type,
key: bytesToHex(key),
},
{
onConflict: 'activity,checksum',
},
);
}
}

Expand Down

0 comments on commit e708388

Please sign in to comment.