Return null if MaxFileSizeBytes is 0 (#2409)

* Return "null" if MaxFileSizeBytes is 0

* Add comment and nil check (better save than sorry)

* Simplify config
This commit is contained in:
Till 2022-05-02 10:47:16 +02:00 committed by GitHub
parent bfa344e831
commit 979a551f1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 18 deletions

View file

@ -36,12 +36,11 @@ func Test_uploadRequest_doUpload(t *testing.T) {
}
maxSize := config.FileSizeBytes(8)
unlimitedSize := config.FileSizeBytes(0)
logger := log.New().WithField("mediaapi", "test")
testdataPath := filepath.Join(wd, "./testdata")
cfg := &config.MediaAPI{
MaxFileSizeBytes: &maxSize,
MaxFileSizeBytes: maxSize,
BasePath: config.Path(testdataPath),
AbsBasePath: config.Path(testdataPath),
DynamicThumbnails: false,
@ -124,7 +123,7 @@ func Test_uploadRequest_doUpload(t *testing.T) {
ctx: context.Background(),
reqReader: strings.NewReader("test test test"),
cfg: &config.MediaAPI{
MaxFileSizeBytes: &unlimitedSize,
MaxFileSizeBytes: config.FileSizeBytes(0),
BasePath: config.Path(testdataPath),
AbsBasePath: config.Path(testdataPath),
DynamicThumbnails: false,