aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorS7evinK <tfaelligen@gmail.com>2021-07-19 18:58:51 +0200
committerGitHub <noreply@github.com>2021-07-19 17:58:51 +0100
commit5094bc89bf9f7f34fa66be3b40379b0056d7758e (patch)
treef2e478ce3e223599b758fc1dbe8f16d10206c8c4 /setup
parent09d3bab8380fd59f855d05ea743062b52fca4045 (diff)
Set MaxFileSizeBytes <= 0 to unlimited (#1876)
* Revert "Set MaxFileSizeBytes <= 0 to "unlimited" (#1875)" This reverts commit 9ed044042156a9bdfafb4ae9830b3ed41225444e. * Actually allow unlimited upload Signed-off-by: Till Faelligen <tfaelligen@gmail.com> Co-authored-by: kegsay <kegan@matrix.org>
Diffstat (limited to 'setup')
-rw-r--r--setup/config/config_mediaapi.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/setup/config/config_mediaapi.go b/setup/config/config_mediaapi.go
index 0943a39e..c55978e1 100644
--- a/setup/config/config_mediaapi.go
+++ b/setup/config/config_mediaapi.go
@@ -2,7 +2,6 @@ package config
import (
"fmt"
- "math"
)
type MediaAPI struct {
@@ -36,6 +35,9 @@ type MediaAPI struct {
ThumbnailSizes []ThumbnailSize `yaml:"thumbnail_sizes"`
}
+// DefaultMaxFileSizeBytes defines the default file size allowed in transfers
+var DefaultMaxFileSizeBytes = FileSizeBytes(10485760)
+
func (c *MediaAPI) Defaults() {
c.InternalAPI.Listen = "http://localhost:7774"
c.InternalAPI.Connect = "http://localhost:7774"
@@ -43,8 +45,7 @@ func (c *MediaAPI) Defaults() {
c.Database.Defaults(5)
c.Database.ConnectionString = "file:mediaapi.db"
- defaultMaxFileSizeBytes := FileSizeBytes(10485760)
- c.MaxFileSizeBytes = &defaultMaxFileSizeBytes
+ c.MaxFileSizeBytes = &DefaultMaxFileSizeBytes
c.MaxThumbnailGenerators = 10
c.BasePath = "./media_store"
}
@@ -58,11 +59,6 @@ func (c *MediaAPI) Verify(configErrs *ConfigErrors, isMonolith bool) {
checkNotEmpty(configErrs, "media_api.database.connection_string", string(c.Database.ConnectionString))
checkNotEmpty(configErrs, "media_api.base_path", string(c.BasePath))
- // allow "unlimited" file size
- if c.MaxFileSizeBytes != nil && *c.MaxFileSizeBytes <= 0 {
- unlimitedSize := FileSizeBytes(math.MaxInt64 - 1)
- c.MaxFileSizeBytes = &unlimitedSize
- }
checkPositive(configErrs, "media_api.max_file_size_bytes", int64(*c.MaxFileSizeBytes))
checkPositive(configErrs, "media_api.max_thumbnail_generators", int64(c.MaxThumbnailGenerators))