get rid of remaining nolint:gosec

This commit is contained in:
Markus Unterwaditzer 2024-10-12 10:54:08 +02:00
commit bd9ce6638e
6 changed files with 12 additions and 9 deletions

View file

@ -25,7 +25,6 @@ import (
"mime/multipart"
"strings"
"codeberg.org/gruf/go-bytesize"
"codeberg.org/gruf/go-iotools"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/config"
@ -300,11 +299,11 @@ func (p *Processor) emojiUpdateCopy(
}
// Get maximum supported local emoji size.
maxsz := config.GetMediaEmojiLocalMaxSize()
maxsz := int(config.GetMediaEmojiLocalMaxSize()) // #nosec G115 -- Already validated
// Ensure target emoji image within size bounds.
if bytesize.Size(target.ImageFileSize) > maxsz { //nolint:gosec
text := fmt.Sprintf("emoji exceeds configured max size: %s", maxsz)
if target.ImageFileSize > maxsz {
text := fmt.Sprintf("emoji exceeds configured max size: %d", maxsz)
return nil, gtserror.NewErrorBadRequest(errors.New(text), text)
}