From cafa013fa58fdfb95d1c45ec80f82c9a51310663 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 5 Aug 2021 11:32:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E6=95=B0=E6=8D=AE=E9=9B=86=E6=98=AF?= =?UTF-8?q?=E5=85=AC=E6=9C=89=E6=97=B6=EF=BC=8C=E4=B8=94=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=A6=82=E6=9E=9C=E8=83=BD=E7=9C=8B=E5=88=B0?= =?UTF-8?q?=EF=BC=8C=E9=82=A3=E4=B9=88=E5=B0=B1=E5=8F=AF=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 6fa89420d..ed9f7c47e 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -177,7 +177,6 @@ func GetAttachment(ctx *context.Context) { ctx.ServerError("checkTypeCloudBrain failed", err) return } - attach, err := models.GetAttachmentByUUID(ctx.Params(":uuid")) if err != nil { if models.IsErrAttachmentNotExist(err) { @@ -187,22 +186,19 @@ func GetAttachment(ctx *context.Context) { } return } - repository, unitType, err := attach.LinkedRepository() if err != nil { ctx.ServerError("LinkedRepository", err) return } - if repository == nil { //If not linked //if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate { //We block if not the uploader - if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && !DownloadUserIsOrgOrCollaboration(ctx, attach) { //We block if not the uploader + if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate && !DownloadUserIsOrgOrCollaboration(ctx, attach) { //We block if not the uploader ctx.Error(http.StatusNotFound) return } } else { //If we have the repository we check access - perm, err := models.GetUserRepoPermission(repository, ctx.User) if err != nil { ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err.Error()) @@ -213,7 +209,6 @@ func GetAttachment(ctx *context.Context) { return } } - dataSet, err := attach.LinkedDataSet() if err != nil { ctx.ServerError("LinkedDataSet", err)