Skip to content

Commit

Permalink
[bugfix] sets the max value placeholders to MaxInt32 instead of MaxInt (
Browse files Browse the repository at this point in the history
#3517)

* sets the max value placeholders to MaxInt32 instead of MaxInt

* update tests
  • Loading branch information
NyaaaWhatsUpDoc authored Nov 5, 2024
1 parent e855a02 commit 6f4cb2f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
36 changes: 18 additions & 18 deletions internal/api/client/instance/instancepatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down Expand Up @@ -271,10 +271,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down Expand Up @@ -412,10 +412,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down Expand Up @@ -604,10 +604,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down Expand Up @@ -767,10 +767,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down Expand Up @@ -949,10 +949,10 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down
12 changes: 6 additions & 6 deletions internal/typeutils/internaltofrontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -1576,9 +1576,9 @@ func (c *Converter) InstanceToAPIV1Instance(ctx context.Context, i *gtsmodel.Ins
instance.Configuration.MediaAttachments.VideoSizeLimit = int(videoSz) // #nosec G115 -- Already validated.

// we don't actually set any limits on these. set to max possible.
instance.Configuration.MediaAttachments.ImageMatrixLimit = math.MaxInt
instance.Configuration.MediaAttachments.VideoFrameRateLimit = math.MaxInt
instance.Configuration.MediaAttachments.VideoMatrixLimit = math.MaxInt
instance.Configuration.MediaAttachments.ImageMatrixLimit = math.MaxInt32
instance.Configuration.MediaAttachments.VideoFrameRateLimit = math.MaxInt32
instance.Configuration.MediaAttachments.VideoMatrixLimit = math.MaxInt32

instance.Configuration.Polls.MaxOptions = config.GetStatusesPollMaxOptions()
instance.Configuration.Polls.MaxCharactersPerOption = config.GetStatusesPollOptionMaxChars()
Expand Down Expand Up @@ -1739,9 +1739,9 @@ func (c *Converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Ins
instance.Configuration.MediaAttachments.VideoSizeLimit = int(videoSz) // #nosec G115 -- Already validated.

// we don't actually set any limits on these. set to max possible.
instance.Configuration.MediaAttachments.ImageMatrixLimit = math.MaxInt
instance.Configuration.MediaAttachments.VideoFrameRateLimit = math.MaxInt
instance.Configuration.MediaAttachments.VideoMatrixLimit = math.MaxInt
instance.Configuration.MediaAttachments.ImageMatrixLimit = math.MaxInt32
instance.Configuration.MediaAttachments.VideoFrameRateLimit = math.MaxInt32
instance.Configuration.MediaAttachments.VideoMatrixLimit = math.MaxInt32

instance.Configuration.Polls.MaxOptions = config.GetStatusesPollMaxOptions()
instance.Configuration.Polls.MaxCharactersPerOption = config.GetStatusesPollOptionMaxChars()
Expand Down
12 changes: 6 additions & 6 deletions internal/typeutils/internaltofrontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1968,10 +1968,10 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down Expand Up @@ -2113,10 +2113,10 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() {
"video/x-matroska"
],
"image_size_limit": 41943040,
"image_matrix_limit": 9223372036854775807,
"image_matrix_limit": 2147483647,
"video_size_limit": 41943040,
"video_frame_rate_limit": 9223372036854775807,
"video_matrix_limit": 9223372036854775807
"video_frame_rate_limit": 2147483647,
"video_matrix_limit": 2147483647
},
"polls": {
"max_options": 6,
Expand Down

0 comments on commit 6f4cb2f

Please sign in to comment.