From 79fb292246b44fde07edf8aa8667ae94ca07d367 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 12 Oct 2024 13:10:01 +0200 Subject: [PATCH] fix the linter for real --- internal/processing/account/update.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go index 285f822dd..2bdbf96f4 100644 --- a/internal/processing/account/update.go +++ b/internal/processing/account/update.go @@ -462,10 +462,11 @@ func (p *Processor) UpdateAvatar( gtserror.WithCode, ) { // Get maximum supported local media size. - maxsz := int64(config.GetMediaLocalMaxSize()) // #nosec G115 -- Already validated. + maxsz := config.GetMediaLocalMaxSize() + maxszInt64 := int64(maxsz) // #nosec G115 -- Already validated. // Ensure media within size bounds. - if avatar.Size > maxsz { + if avatar.Size > maxszInt64 { text := fmt.Sprintf("media exceeds configured max size: %s", maxsz) return nil, gtserror.NewErrorBadRequest(errors.New(text), text) } @@ -478,7 +479,7 @@ func (p *Processor) UpdateAvatar( } // Wrap the multipart file reader to ensure is limited to max. - rc, _, _ := iotools.UpdateReadCloserLimit(mpfile, maxsz) + rc, _, _ := iotools.UpdateReadCloserLimit(mpfile, maxszInt64) // Write to instance storage. return p.c.StoreLocalMedia(ctx, @@ -507,10 +508,11 @@ func (p *Processor) UpdateHeader( gtserror.WithCode, ) { // Get maximum supported local media size. - maxsz := int64(config.GetMediaLocalMaxSize()) // #nosec G115 -- Already validated. + maxsz := config.GetMediaLocalMaxSize() + maxszInt64 := int64(maxsz) // #nosec G115 -- Already validated. // Ensure media within size bounds. - if header.Size > maxsz { + if header.Size > maxszInt64 { text := fmt.Sprintf("media exceeds configured max size: %s", maxsz) return nil, gtserror.NewErrorBadRequest(errors.New(text), text) } @@ -523,7 +525,7 @@ func (p *Processor) UpdateHeader( } // Wrap the multipart file reader to ensure is limited to max. - rc, _, _ := iotools.UpdateReadCloserLimit(mpfile, maxsz) + rc, _, _ := iotools.UpdateReadCloserLimit(mpfile, maxszInt64) // Write to instance storage. return p.c.StoreLocalMedia(ctx,