refactor: make PostUploadLimit uint64
This commit is contained in:
parent
fc40563ae4
commit
ea8c50edc7
|
@ -356,7 +356,7 @@ func (s *S5API) prepareFileUpload(jc jape.Context) (file io.ReadSeekCloser, s5Er
|
||||||
|
|
||||||
// Handle multipart form data uploads
|
// Handle multipart form data uploads
|
||||||
if strings.HasPrefix(contentType, "multipart/form-data") {
|
if strings.HasPrefix(contentType, "multipart/form-data") {
|
||||||
if err := r.ParseMultipartForm(s.config.Config().Core.PostUploadLimit); err != nil {
|
if err := r.ParseMultipartForm(int64(s.config.Config().Core.PostUploadLimit)); err != nil {
|
||||||
return nil, NewS5Error(ErrKeyFileUploadFailed, err)
|
return nil, NewS5Error(ErrKeyFileUploadFailed, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +746,7 @@ func (s *S5API) directoryUpload(jc jape.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse multipart form with size limit from config
|
// Parse multipart form with size limit from config
|
||||||
if err := jc.Request.ParseMultipartForm(s.config.Config().Core.PostUploadLimit); err != nil {
|
if err := jc.Request.ParseMultipartForm(int64(s.config.Config().Core.PostUploadLimit)); err != nil {
|
||||||
s.sendErrorResponse(jc, NewS5Error(ErrKeyInvalidOperation, err))
|
s.sendErrorResponse(jc, NewS5Error(ErrKeyInvalidOperation, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ type CoreConfig struct {
|
||||||
Identity string `mapstructure:"identity"`
|
Identity string `mapstructure:"identity"`
|
||||||
Log LogConfig `mapstructure:"log"`
|
Log LogConfig `mapstructure:"log"`
|
||||||
Port uint `mapstructure:"port"`
|
Port uint `mapstructure:"port"`
|
||||||
PostUploadLimit int64 `mapstructure:"post_upload_limit"`
|
PostUploadLimit uint64 `mapstructure:"post_upload_limit"`
|
||||||
Sia SiaConfig `mapstructure:"sia"`
|
Sia SiaConfig `mapstructure:"sia"`
|
||||||
Storage StorageConfig `mapstructure:"storage"`
|
Storage StorageConfig `mapstructure:"storage"`
|
||||||
Protocols []string `mapstructure:"protocols"`
|
Protocols []string `mapstructure:"protocols"`
|
||||||
|
|
Loading…
Reference in New Issue