Skip to content

The open-source app everyone uses to manage agents at work

Clean up attachment objects on issue delete and suppress responseTime in logs

Forgottena22af8f72fae
diff --git a/server/src/middleware/logger.ts b/server/src/middleware/logger.ts
index bd9ded9dd3..bfcebd22ee 100644
--- a/server/src/middleware/logger.ts
+++ b/server/src/middleware/logger.ts
@@ -19,7 +19,7 @@ export const logger = pino({
targets: [
{
target: "pino-pretty",
- options: { ...sharedOpts, ignore: "pid,hostname,req,res", colorize: true, destination: 1 },
+ options: { ...sharedOpts, ignore: "pid,hostname,req,res,responseTime", colorize: true, destination: 1 },
level: "info",
},
{
diff --git a/server/src/routes/issues.ts b/server/src/routes/issues.ts
index b75a0bb345..e997d0b3ab 100644
--- a/server/src/routes/issues.ts
+++ b/server/src/routes/issues.ts
@@ -320,6 +320,7 @@ export function issueRoutes(db: Db, storage: StorageService) {
return;
}
assertCompanyAccess(req, existing.companyId);
+ const attachments = await svc.listAttachments(id);
const issue = await svc.remove(id);
if (!issue) {
@@ -327,6 +328,14 @@ export function issueRoutes(db: Db, storage: StorageService) {
return;
}
+ for (const attachment of attachments) {
+ try {
+ await storage.deleteObject(attachment.companyId, attachment.objectKey);
+ } catch (err) {
+ logger.warn({ err, issueId: id, attachmentId: attachment.id }, "failed to delete attachment object during issue delete");
+ }
+ }
+
const actor = getActorInfo(req);
await logActivity(db, {
companyId: issue.companyId,