mirror of
https://github.com/certd/certd.git
synced 2026-04-20 09:50:50 +08:00
fix: 修复偶尔下载证书报未授权的错误
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user