diff --git a/backend/src/routes/file.ts b/backend/src/routes/file.ts index 868785c8d..5a743a8a0 100644 --- a/backend/src/routes/file.ts +++ b/backend/src/routes/file.ts @@ -506,7 +506,7 @@ export class FileRoutes { async fetchValidVersions(queryRunner: QueryRunner, file: File) { return await queryRunner.manager.find(RegularFile, { - where: { s3key: s3Key(file), tombstoneReason: IsNull() }, + where: { filename: s3Key(file), tombstoneReason: IsNull() }, relations: { product: true, site: true }, order: { createdAt: "DESC" }, }); diff --git a/backend/tests/integration/sequential/file.test.ts b/backend/tests/integration/sequential/file.test.ts index 03ecd2b11..83d12ac84 100644 --- a/backend/tests/integration/sequential/file.test.ts +++ b/backend/tests/integration/sequential/file.test.ts @@ -586,10 +586,10 @@ describe("DELETE /api/files/", () => { const categorizeFile = await putDummyFile({ product: "categorize", sourceFileIds: [radarFile.uuid] }); await putDummyImage("categorize-ldr.png", categorizeFile); await expect(deleteFile(radarFile.uuid, true, false)).resolves.toMatchObject({ status: 200 }); - // await expect(fileRepo.findOneBy({ uuid: radarFile.uuid })).resolves.toBeFalsy(); - // await expect(fileRepo.findOneBy({ uuid: categorizeFile.uuid })).resolves.toBeFalsy(); - // await expect(vizRepo.findOneBy({ s3key: "radar-v.png" })).resolves.toBeFalsy(); - // await expect(vizRepo.findOneBy({ s3key: "categorize-ldr.png" })).resolves.toBeFalsy(); + await expect(fileRepo.findOneBy({ uuid: radarFile.uuid })).resolves.toBeFalsy(); + await expect(fileRepo.findOneBy({ uuid: categorizeFile.uuid })).resolves.toBeFalsy(); + await expect(vizRepo.findOneBy({ s3key: "radar-v.png" })).resolves.toBeFalsy(); + await expect(vizRepo.findOneBy({ s3key: "categorize-ldr.png" })).resolves.toBeFalsy(); }); it("does not delete with dryRun parameter", async () => { @@ -896,7 +896,6 @@ describe("DELETE /api/files/", () => { if (legacy) file.legacy = true; if (product === "model" && !file.model) file.model = "ecmwf"; const bucketFix = volatile ? "-volatile" : ""; - console.log(file); await axios.put(`${storageServiceUrl}cloudnet-product${bucketFix}/${file.s3key}`, "content"); await expect(putFile(file)).resolves.toMatchObject({ status: statusCode }); return file;