mirror of
https://github.com/usememos/memos.git
synced 2025-02-27 14:54:38 +08:00
chore: update resource max size
This commit is contained in:
parent
1fb8018f0b
commit
cc2af0e449
2 changed files with 7 additions and 1 deletions
|
@ -5,6 +5,7 @@ var Codes = map[string]int{
|
||||||
|
|
||||||
"REQUEST_BODY_ERROR": 40001,
|
"REQUEST_BODY_ERROR": 40001,
|
||||||
"UPLOAD_FILE_ERROR": 40002,
|
"UPLOAD_FILE_ERROR": 40002,
|
||||||
|
"OVERLOAD_MAX_SIZE": 40003,
|
||||||
"NOT_FOUND": 40400,
|
"NOT_FOUND": 40400,
|
||||||
"USER_NOT_FOUND": 40401,
|
"USER_NOT_FOUND": 40401,
|
||||||
"RESOURCE_NOT_FOUND": 40402,
|
"RESOURCE_NOT_FOUND": 40402,
|
||||||
|
|
|
@ -31,7 +31,12 @@ func handleGetMyResources(w http.ResponseWriter, r *http.Request) {
|
||||||
func handleUploadResource(w http.ResponseWriter, r *http.Request) {
|
func handleUploadResource(w http.ResponseWriter, r *http.Request) {
|
||||||
userId, _ := GetUserIdInSession(r)
|
userId, _ := GetUserIdInSession(r)
|
||||||
|
|
||||||
r.ParseMultipartForm(10 << 20)
|
err := r.ParseMultipartForm(5 << 20)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
e.ErrorHandler(w, "OVERLOAD_MAX_SIZE", "The max size of resource is 5Mb.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
file, handler, err := r.FormFile("file")
|
file, handler, err := r.FormFile("file")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue