fix(api): 🐛 Local media uploader: don't error out when a file has already been uploaded

This commit is contained in:
Jesse Wierzbinski 2024-05-12 16:18:07 -10:00
parent da2520e60e
commit 9ad0f88ff2
No known key found for this signature in database

View file

@ -116,7 +116,12 @@ export class LocalMediaBackend extends MediaBackend {
); );
if (await newFile.exists()) { if (await newFile.exists()) {
throw new Error("File already exists"); // Already exists, we don't need to upload it again
return {
uploadedFile: convertedFile,
path: `${hash}/${convertedFile.name}`,
hash: hash,
};
} }
await Bun.write(newFile, convertedFile); await Bun.write(newFile, convertedFile);