summaryrefslogtreecommitdiff
path: root/internal/federation
diff options
context:
space:
mode:
authorLibravatar Markus Unterwaditzer <markus-tarpit+git@unterwaditzer.net>2024-10-16 14:13:58 +0200
committerLibravatar GitHub <noreply@github.com>2024-10-16 14:13:58 +0200
commita48cce82b9b235a0e844104a89453eb0bd4d4409 (patch)
treeac319b5c6854710df74d605e3e266d8bc320b530 /internal/federation
parent[docs] remove duplicate entry from supported platforms (#3442) (diff)
downloadgotosocial-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/federation')
-rw-r--r--internal/federation/dereferencing/emoji.go12
-rw-r--r--internal/federation/dereferencing/media.go8
2 files changed, 10 insertions, 10 deletions
diff --git a/internal/federation/dereferencing/emoji.go b/internal/federation/dereferencing/emoji.go
index 12c648556..1ac27f2b2 100644
--- a/internal/federation/dereferencing/emoji.go
+++ b/internal/federation/dereferencing/emoji.go
@@ -97,11 +97,11 @@ func (d *Dereferencer) GetEmoji(
}
// Get maximum supported remote emoji size.
- maxsz := config.GetMediaEmojiRemoteMaxSize()
+ maxsz := int64(config.GetMediaEmojiRemoteMaxSize()) // #nosec G115 -- Already validated.
// Prepare data function to dereference remote emoji media.
data := func(context.Context) (io.ReadCloser, error) {
- return tsport.DereferenceMedia(ctx, url, int64(maxsz))
+ return tsport.DereferenceMedia(ctx, url, maxsz)
}
// Create new emoji with prepared info.
@@ -189,11 +189,11 @@ func (d *Dereferencer) RefreshEmoji(
}
// Get maximum supported remote emoji size.
- maxsz := config.GetMediaEmojiRemoteMaxSize()
+ maxsz := int64(config.GetMediaEmojiRemoteMaxSize()) // #nosec G115 -- Already validated.
// Prepare data function to dereference remote emoji media.
data := func(context.Context) (io.ReadCloser, error) {
- return tsport.DereferenceMedia(ctx, url, int64(maxsz))
+ return tsport.DereferenceMedia(ctx, url, maxsz)
}
// Update emoji with prepared info.
@@ -255,11 +255,11 @@ func (d *Dereferencer) RecacheEmoji(
}
// Get maximum supported remote emoji size.
- maxsz := config.GetMediaEmojiRemoteMaxSize()
+ maxsz := int64(config.GetMediaEmojiRemoteMaxSize()) // #nosec G115 -- Already validated.
// Prepare data function to dereference remote emoji media.
data := func(context.Context) (io.ReadCloser, error) {
- return tsport.DereferenceMedia(ctx, url, int64(maxsz))
+ return tsport.DereferenceMedia(ctx, url, maxsz)
}
// Recache emoji with prepared info.
diff --git a/internal/federation/dereferencing/media.go b/internal/federation/dereferencing/media.go
index 859e5603f..3bed4b198 100644
--- a/internal/federation/dereferencing/media.go
+++ b/internal/federation/dereferencing/media.go
@@ -77,14 +77,14 @@ func (d *Dereferencer) GetMedia(
}
// Get maximum supported remote media size.
- maxsz := config.GetMediaRemoteMaxSize()
+ maxsz := int64(config.GetMediaRemoteMaxSize()) // #nosec G115 -- Already validated.
// Create media with prepared info.
return d.mediaManager.CreateMedia(
ctx,
accountID,
func(ctx context.Context) (io.ReadCloser, error) {
- return tsport.DereferenceMedia(ctx, url, int64(maxsz))
+ return tsport.DereferenceMedia(ctx, url, maxsz)
},
info,
)
@@ -168,14 +168,14 @@ func (d *Dereferencer) RefreshMedia(
}
// Get maximum supported remote media size.
- maxsz := config.GetMediaRemoteMaxSize()
+ maxsz := int64(config.GetMediaRemoteMaxSize()) // #nosec G115 -- Already validated.
// Recache media with prepared info,
// this will also update media in db.
return d.mediaManager.CacheMedia(
attach,
func(ctx context.Context) (io.ReadCloser, error) {
- return tsport.DereferenceMedia(ctx, url, int64(maxsz))
+ return tsport.DereferenceMedia(ctx, url, maxsz)
},
), nil
},