diff options
author | S7evinK <tfaelligen@gmail.com> | 2021-06-14 15:12:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-14 14:12:03 +0100 |
commit | 9ed044042156a9bdfafb4ae9830b3ed41225444e (patch) | |
tree | 7486c619495a61770a26e6cc1f08455ec0c0a767 /setup | |
parent | 9633ed747d9629a838e2308530251aadc3585d4c (diff) |
Set MaxFileSizeBytes <= 0 to "unlimited" (#1875)
* Set MaxFileSizeBytes < 0 to "unlimited"
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
* int64 overflows later in mediaapi/routing/upload.go[doUpload]
* Prevent int overflow when uploading
Diffstat (limited to 'setup')
-rw-r--r-- | setup/config/config_mediaapi.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/setup/config/config_mediaapi.go b/setup/config/config_mediaapi.go index 660a508d..0943a39e 100644 --- a/setup/config/config_mediaapi.go +++ b/setup/config/config_mediaapi.go @@ -2,6 +2,7 @@ package config import ( "fmt" + "math" ) type MediaAPI struct { @@ -57,6 +58,11 @@ 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)) |