diff options
author | 2022-11-03 15:03:12 +0100 | |
---|---|---|
committer | 2022-11-03 15:03:12 +0100 | |
commit | 1dfa7fe0d51b75792db7b0c28ffad7d1f650834d (patch) | |
tree | 0af4de062d33e6c292d8b42dbf4d13f16125b959 /internal/processing/media/getfile_test.go | |
parent | [bugfix] Use []rune to check length of user-submitted text (#948) (diff) | |
download | gotosocial-1dfa7fe0d51b75792db7b0c28ffad7d1f650834d.tar.xz |
[bugfix] Wrap media in read closer (#941)
* use readcloser for content.Content
* call media postdata function no matter what
* return a readcloser from data func
* tidy of logic of readertostore
* fix whoopsie
Diffstat (limited to 'internal/processing/media/getfile_test.go')
-rw-r--r-- | internal/processing/media/getfile_test.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/internal/processing/media/getfile_test.go b/internal/processing/media/getfile_test.go index 6e5271607..ba7269535 100644 --- a/internal/processing/media/getfile_test.go +++ b/internal/processing/media/getfile_test.go @@ -91,10 +91,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncached() { suite.NotNil(content) b, err := io.ReadAll(content.Content) suite.NoError(err) - - if closer, ok := content.Content.(io.Closer); ok { - suite.NoError(closer.Close()) - } + suite.NoError(content.Content.Close()) suite.Equal(suite.testRemoteAttachments[testAttachment.RemoteURL].Data, b) suite.Equal(suite.testRemoteAttachments[testAttachment.RemoteURL].ContentType, content.ContentType) @@ -151,9 +148,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncachedInterrupted() { suite.NoError(err) // close the reader - if closer, ok := content.Content.(io.Closer); ok { - suite.NoError(closer.Close()) - } + suite.NoError(content.Content.Close()) // the attachment should still be updated in the database even though the caller hung up if !testrig.WaitFor(func() bool { @@ -201,10 +196,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileThumbnailUncached() { suite.NotNil(content) b, err := io.ReadAll(content.Content) suite.NoError(err) - - if closer, ok := content.Content.(io.Closer); ok { - suite.NoError(closer.Close()) - } + suite.NoError(content.Content.Close()) suite.Equal(thumbnailBytes, b) suite.Equal("image/jpeg", content.ContentType) |