mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
chore: ⬆️ Upgrade Bun to 1.2.0
This commit is contained in:
parent
e32b6f9f8e
commit
c4339e64bd
7 changed files with 17 additions and 8 deletions
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue