diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-03-22 08:03:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 15:03:22 +0800 |
commit | 80fd25524e13dedbdc3527b32d008de152213a89 (patch) | |
tree | 63b2bfe4ffaf1dce12080cabdc2e845c8731a673 /routers/web/repo/attachment.go | |
parent | 5495ba7660979973ba19e304786135da474e0e64 (diff) | |
download | gitea-80fd25524e13dedbdc3527b32d008de152213a89.tar.gz gitea-80fd25524e13dedbdc3527b32d008de152213a89.zip |
Renamed ctx.User to ctx.Doer. (#19161)
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/web/repo/attachment.go')
-rw-r--r-- | routers/web/repo/attachment.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/web/repo/attachment.go b/routers/web/repo/attachment.go index 4101d81ac5..be5b5812d3 100644 --- a/routers/web/repo/attachment.go +++ b/routers/web/repo/attachment.go @@ -44,7 +44,7 @@ func uploadAttachment(ctx *context.Context, repoID int64, allowedTypes string) { } defer file.Close() - attach, err := attachment.UploadAttachment(file, ctx.User.ID, repoID, 0, header.Filename, allowedTypes) + attach, err := attachment.UploadAttachment(file, ctx.Doer.ID, repoID, 0, header.Filename, allowedTypes) if err != nil { if upload.IsErrFileTypeForbidden(err) { ctx.Error(http.StatusBadRequest, err.Error()) @@ -68,7 +68,7 @@ func DeleteAttachment(ctx *context.Context) { ctx.Error(http.StatusBadRequest, err.Error()) return } - if !ctx.IsSigned || (ctx.User.ID != attach.UploaderID) { + if !ctx.IsSigned || (ctx.Doer.ID != attach.UploaderID) { ctx.Error(http.StatusForbidden) return } @@ -101,12 +101,12 @@ func GetAttachment(ctx *context.Context) { } if repository == nil { // If not linked - if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) { // We block if not the uploader + if !(ctx.IsSigned && attach.UploaderID == ctx.Doer.ID) { // 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) + perm, err := models.GetUserRepoPermission(repository, ctx.Doer) if err != nil { ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err.Error()) return |