diff options
author | 2024-10-16 14:13:58 +0200 | |
---|---|---|
committer | 2024-10-16 14:13:58 +0200 | |
commit | a48cce82b9b235a0e844104a89453eb0bd4d4409 (patch) | |
tree | ac319b5c6854710df74d605e3e266d8bc320b530 /internal/api | |
parent | [docs] remove duplicate entry from supported platforms (#3442) (diff) | |
download | gotosocial-a48cce82b9b235a0e844104a89453eb0bd4d4409.tar.xz |
[chore] Upgrade golangci-lint, ignore existing int overflow warnings (#3420)
* [chore] Bump tooling versions, bump go -> v1.23.0
* undo silly change
* sign
* bump go version in go.mod
* allow overflow in imaging
* goreleaser deprecation notices
* [chore] Upgrade golangci-lint, ignore existing int overflow warnings
There is a new lint for unchecked int casts. Integer overflows are bad,
but the old code that triggers this lint seems to be perfectly fine.
Instead of disabling the lint entirely for new code as well, grandfather
in existing code.
* fix golangci-lint documentation link
* revert unrelated changes
* revert another unrelated change
* get rid of remaining nolint:gosec
* swagger updates
* apply review feedback
* fix wrong formatting specifier thing
* fix the linter for real
---------
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/api')
-rw-r--r-- | internal/api/client/admin/emojicreate.go | 4 | ||||
-rw-r--r-- | internal/api/client/admin/emojiupdate.go | 4 | ||||
-rw-r--r-- | internal/api/model/attachment.go | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/internal/api/client/admin/emojicreate.go b/internal/api/client/admin/emojicreate.go index 75661f1c3..9696200de 100644 --- a/internal/api/client/admin/emojicreate.go +++ b/internal/api/client/admin/emojicreate.go @@ -145,8 +145,8 @@ func validateCreateEmoji(form *apimodel.EmojiCreateRequest) error { return errors.New("no emoji given") } - maxSize := config.GetMediaEmojiLocalMaxSize() - if form.Image.Size > int64(maxSize) { + maxSize := int64(config.GetMediaEmojiLocalMaxSize()) // #nosec G115 -- Already validated. + if form.Image.Size > maxSize { return fmt.Errorf("emoji image too large: image is %dKB but size limit for custom emojis is %dKB", form.Image.Size/1024, maxSize/1024) } diff --git a/internal/api/client/admin/emojiupdate.go b/internal/api/client/admin/emojiupdate.go index 37f67cabd..ec6987024 100644 --- a/internal/api/client/admin/emojiupdate.go +++ b/internal/api/client/admin/emojiupdate.go @@ -208,8 +208,8 @@ func validateUpdateEmoji(form *apimodel.EmojiUpdateRequest) error { } if hasImage { - maxSize := config.GetMediaEmojiLocalMaxSize() - if form.Image.Size > int64(maxSize) { + maxSize := int64(config.GetMediaEmojiLocalMaxSize()) // #nosec G115 -- Already validated. + if form.Image.Size > maxSize { return fmt.Errorf("emoji image too large: image is %dKB but size limit for custom emojis is %dKB", form.Image.Size/1024, maxSize/1024) } } diff --git a/internal/api/model/attachment.go b/internal/api/model/attachment.go index 21523a58e..f037a09aa 100644 --- a/internal/api/model/attachment.go +++ b/internal/api/model/attachment.go @@ -160,7 +160,7 @@ type MediaDimensions struct { Duration float32 `json:"duration,omitempty"` // Bitrate of the media in bits per second. // example: 1000000 - Bitrate int `json:"bitrate,omitempty"` + Bitrate uint64 `json:"bitrate,omitempty"` // Size of the media, in the format `[width]x[height]`. // Not set for audio. // example: 1920x1080 |