fix: 修复偶尔下载证书报未授权的错误

This commit is contained in:
xiaojunnuo
2026-02-27 00:37:24 +08:00
parent b2c421600c
commit 316537eb4d
10 changed files with 48 additions and 14 deletions
@@ -162,12 +162,15 @@ export class CertInfoController extends CrudController<CertInfoService> {
@Get('/download', { summary: Constants.per.authOnly })
async download(@Query('id') id: number) {
await this.checkOwner(this.getService(),id,"read");
const {userId,projectId} =await this.checkOwner(this.getService(),id,"read");
const certInfo = await this.getService().info(id)
if (certInfo == null) {
throw new CommonException('file not found');
}
if (certInfo.userId !== this.getUserId()) {
if (certInfo.userId !== userId) {
throw new CommonException('file not found');
}
if (projectId && certInfo.projectId !== projectId) {
throw new CommonException('file not found');
}
// koa send file