chore: ⬆️ Upgrade Bun to 1.2.0

This commit is contained in:
Jesse Wierzbinski 2025-01-23 15:28:16 +01:00
parent e32b6f9f8e
commit c4339e64bd
No known key found for this signature in database
7 changed files with 17 additions and 8 deletions

View file

@ -29,6 +29,9 @@ describe("DiskMediaDriver", () => {
media: {
local_uploads_folder: "/test/uploads",
},
http: {
base_url: "http://localhost:3000",
},
} as Config;
mockMediaHasher = mock(() => Promise.resolve("testhash"));

View file

@ -80,6 +80,12 @@ export class DiskMediaDriver implements MediaDriver {
*/
public async deleteFileByUrl(url: string): Promise<void> {
const urlObj = new URL(url);
// Check if URL is from the local uploads folder
if (urlObj.host !== new URL(this.config.http.base_url).host) {
return Promise.resolve();
}
const hash = urlObj.pathname.split("/").at(-2);
if (!hash) {
throw new Error("Invalid URL");