File tree Expand file tree Collapse file tree 3 files changed +0
-42
lines changed Expand file tree Collapse file tree 3 files changed +0
-42
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,10 @@ package org
5
5
6
6
import (
7
7
"encoding/base64"
8
- "fmt"
9
8
"net/http"
10
9
11
10
"code.gitea.io/gitea/modules/context"
12
- "code.gitea.io/gitea/modules/setting"
13
11
api "code.gitea.io/gitea/modules/structs"
14
- "code.gitea.io/gitea/modules/typesniffer"
15
12
"code.gitea.io/gitea/modules/web"
16
13
user_service "code.gitea.io/gitea/services/user"
17
14
)
@@ -42,17 +39,6 @@ func UpdateAvatar(ctx *context.APIContext) {
42
39
return
43
40
}
44
41
45
- if int64 (len (content )) > setting .Avatar .MaxFileSize {
46
- ctx .Error (http .StatusBadRequest , "AvatarTooBig" , fmt .Errorf ("The avatar is to big" ))
47
- return
48
- }
49
-
50
- st := typesniffer .DetectContentType (content )
51
- if ! (st .IsImage () && ! st .IsSvgImage ()) {
52
- ctx .Error (http .StatusBadRequest , "NotAnImage" , fmt .Errorf ("The avatar is not an image" ))
53
- return
54
- }
55
-
56
42
err = user_service .UploadAvatar (ctx .Org .Organization .AsUser (), content )
57
43
if err != nil {
58
44
ctx .Error (http .StatusInternalServerError , "UploadAvatar" , err )
Original file line number Diff line number Diff line change @@ -5,13 +5,10 @@ package repo
5
5
6
6
import (
7
7
"encoding/base64"
8
- "fmt"
9
8
"net/http"
10
9
11
10
"code.gitea.io/gitea/modules/context"
12
- "code.gitea.io/gitea/modules/setting"
13
11
api "code.gitea.io/gitea/modules/structs"
14
- "code.gitea.io/gitea/modules/typesniffer"
15
12
"code.gitea.io/gitea/modules/web"
16
13
repo_service "code.gitea.io/gitea/services/repository"
17
14
)
@@ -49,17 +46,6 @@ func UpdateAvatar(ctx *context.APIContext) {
49
46
return
50
47
}
51
48
52
- if int64 (len (content )) > setting .Avatar .MaxFileSize {
53
- ctx .Error (http .StatusBadRequest , "AvatarTooBig" , fmt .Errorf ("The avatar is to big" ))
54
- return
55
- }
56
-
57
- st := typesniffer .DetectContentType (content )
58
- if ! (st .IsImage () && ! st .IsSvgImage ()) {
59
- ctx .Error (http .StatusBadRequest , "NotAnImage" , fmt .Errorf ("The avatar is not an image" ))
60
- return
61
- }
62
-
63
49
err = repo_service .UploadAvatar (ctx , ctx .Repo .Repository , content )
64
50
if err != nil {
65
51
ctx .Error (http .StatusInternalServerError , "UploadAvatar" , err )
Original file line number Diff line number Diff line change @@ -5,13 +5,10 @@ package user
5
5
6
6
import (
7
7
"encoding/base64"
8
- "fmt"
9
8
"net/http"
10
9
11
10
"code.gitea.io/gitea/modules/context"
12
- "code.gitea.io/gitea/modules/setting"
13
11
api "code.gitea.io/gitea/modules/structs"
14
- "code.gitea.io/gitea/modules/typesniffer"
15
12
"code.gitea.io/gitea/modules/web"
16
13
user_service "code.gitea.io/gitea/services/user"
17
14
)
@@ -39,17 +36,6 @@ func UpdateAvatar(ctx *context.APIContext) {
39
36
return
40
37
}
41
38
42
- if int64 (len (content )) > setting .Avatar .MaxFileSize {
43
- ctx .Error (http .StatusBadRequest , "AvatarTooBig" , fmt .Errorf ("The avatar is to big" ))
44
- return
45
- }
46
-
47
- st := typesniffer .DetectContentType (content )
48
- if ! (st .IsImage () && ! st .IsSvgImage ()) {
49
- ctx .Error (http .StatusBadRequest , "NotAnImage" , fmt .Errorf ("The avatar is not an image" ))
50
- return
51
- }
52
-
53
39
err = user_service .UploadAvatar (ctx .Doer , content )
54
40
if err != nil {
55
41
ctx .Error (http .StatusInternalServerError , "UploadAvatar" , err )
You can’t perform that action at this time.
0 commit comments