IO-2221 Clean up Thumbnails on delete
This commit is contained in:
@@ -5,7 +5,11 @@ import { logger } from "../server";
|
||||
import MediaFile from "../util/interfaces/MediaFile";
|
||||
import ListableChecker from "../util/listableChecker";
|
||||
import { PathToRoBillsFolder, PathToRoFolder } from "../util/pathGenerators";
|
||||
import { BillsRelativeFilePath, JobRelativeFilePath } from "../util/serverInit";
|
||||
import {
|
||||
BillsRelativeFilePath,
|
||||
FolderPaths,
|
||||
JobRelativeFilePath,
|
||||
} from "../util/serverInit";
|
||||
|
||||
export async function JobsDeleteMedia(req: Request, res: Response) {
|
||||
const jobid: string = (req.body.jobid || "").trim();
|
||||
@@ -32,6 +36,14 @@ export async function JobsDeleteMedia(req: Request, res: Response) {
|
||||
if (files.includes(path.parse(path.basename(file.name)).base)) {
|
||||
// File is in the set of requested files.
|
||||
await fs.remove(JobRelativeFilePath(jobid, file.name));
|
||||
await fs.remove(
|
||||
path.join(
|
||||
FolderPaths.Jobs,
|
||||
jobid,
|
||||
FolderPaths.ThumbsSubDir,
|
||||
file.name
|
||||
)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
@@ -40,6 +52,15 @@ export async function JobsDeleteMedia(req: Request, res: Response) {
|
||||
if (files.includes(path.parse(path.basename(file.name)).base)) {
|
||||
// File is in the set of requested files.
|
||||
await fs.remove(BillsRelativeFilePath(jobid, file.name));
|
||||
await fs.remove(
|
||||
path.join(
|
||||
FolderPaths.Jobs,
|
||||
jobid,
|
||||
FolderPaths.BillsSubDir,
|
||||
FolderPaths.ThumbsSubDir,
|
||||
file.name
|
||||
)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user