mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(api): 🐛 Local media uploader: don't error out when a file has already been uploaded
This commit is contained in:
parent
da2520e60e
commit
9ad0f88ff2
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue