mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-22 05:58:02 +02:00
Add max-file-size to LFS (#10463)
* Add max-file-size to LFS * Update modules/lfs/server.go * As per @silverwind Co-Authored-By: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
This commit is contained in:
@ -233,6 +233,12 @@ func PostHandler(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if setting.LFS.MaxFileSize > 0 && rv.Size > setting.LFS.MaxFileSize {
|
||||
log.Info("Denied LFS upload of size %d to %s/%s because of LFS_MAX_FILE_SIZE=%d", rv.Size, rv.User, rv.Repo, setting.LFS.MaxFileSize)
|
||||
writeStatus(ctx, 413)
|
||||
return
|
||||
}
|
||||
|
||||
meta, err := models.NewLFSMetaObject(&models.LFSMetaObject{Oid: rv.Oid, Size: rv.Size, RepositoryID: repository.ID})
|
||||
if err != nil {
|
||||
writeStatus(ctx, 404)
|
||||
|
@ -140,6 +140,7 @@ var (
|
||||
JWTSecretBase64 string `ini:"LFS_JWT_SECRET"`
|
||||
JWTSecretBytes []byte `ini:"-"`
|
||||
HTTPAuthExpiry time.Duration `ini:"LFS_HTTP_AUTH_EXPIRY"`
|
||||
MaxFileSize int64 `ini:"LFS_MAX_FILE_SIZE"`
|
||||
}
|
||||
|
||||
// Security settings
|
||||
|
Reference in New Issue
Block a user