fix: only log FILE_DOWNLOADED for actual downloads, not preview URLs
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
getDownloadUrl was logging FILE_DOWNLOADED on every call including inline previews and thumbnail loads. Now only logs when forDownload is true (explicit download button click), massively reducing noise. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -124,16 +124,18 @@ export const fileRouter = router({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log file access
|
// Only log actual downloads, not preview/view URL requests
|
||||||
await logAudit({
|
if (input.forDownload) {
|
||||||
prisma: ctx.prisma,
|
await logAudit({
|
||||||
userId: ctx.user.id,
|
prisma: ctx.prisma,
|
||||||
action: 'FILE_DOWNLOADED',
|
userId: ctx.user.id,
|
||||||
entityType: 'ProjectFile',
|
action: 'FILE_DOWNLOADED',
|
||||||
detailsJson: { bucket: input.bucket, objectKey: input.objectKey },
|
entityType: 'ProjectFile',
|
||||||
ipAddress: ctx.ip,
|
detailsJson: { bucket: input.bucket, objectKey: input.objectKey, fileName: input.fileName },
|
||||||
userAgent: ctx.userAgent,
|
ipAddress: ctx.ip,
|
||||||
})
|
userAgent: ctx.userAgent,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return { url }
|
return { url }
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user