Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
cc2af0e4
Commit
cc2af0e4
authored
Dec 16, 2021
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update resource max size
parent
1fb8018f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
codes.go
api/e/codes.go
+1
-0
resource.go
api/resource.go
+6
-1
No files found.
api/e/codes.go
View file @
cc2af0e4
...
...
@@ -5,6 +5,7 @@ var Codes = map[string]int{
"REQUEST_BODY_ERROR"
:
40001
,
"UPLOAD_FILE_ERROR"
:
40002
,
"OVERLOAD_MAX_SIZE"
:
40003
,
"NOT_FOUND"
:
40400
,
"USER_NOT_FOUND"
:
40401
,
"RESOURCE_NOT_FOUND"
:
40402
,
...
...
api/resource.go
View file @
cc2af0e4
...
...
@@ -31,7 +31,12 @@ func handleGetMyResources(w http.ResponseWriter, r *http.Request) {
func
handleUploadResource
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
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"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment