@@ -15,6 +15,7 @@ import (
1515 "time"
1616
1717 "github.com/rclone/rclone/backend/doi/api"
18+ "github.com/rclone/rclone/fs"
1819 "github.com/rclone/rclone/fs/config/configmap"
1920 "github.com/rclone/rclone/fs/hash"
2021 "github.com/stretchr/testify/assert"
@@ -136,7 +137,7 @@ func prepareMockZenodoServer(t *testing.T, files map[string]string) *httptest.Se
136137 Checksum : md5Sum (contents ),
137138 Size : int64 (len (contents )),
138139 Updated : time .Now ().UTC ().Format (time .RFC3339 ),
139- MimeType : "text/plain" ,
140+ MimeType : "text/plain; charset=utf-8 " ,
140141 Links : api.InvenioFilesResponseEntryLinks {
141142 Content : filesBaseURL .JoinPath (filename ).String (),
142143 },
@@ -197,11 +198,11 @@ func TestZenodoRemote(t *testing.T) {
197198 "provider" : "zenodo" ,
198199 "doi_resolver_api_url" : doiResolverApiUrl ,
199200 }
200- fs , err := NewFs (context .Background (), remoteName , "" , testConfig )
201+ f , err := NewFs (context .Background (), remoteName , "" , testConfig )
201202 require .NoError (t , err )
202203
203204 // Test listing the DOI files
204- entries , err := fs .List (context .Background (), "" )
205+ entries , err := f .List (context .Background (), "" )
205206 require .NoError (t , err )
206207
207208 sort .Sort (entries )
@@ -221,7 +222,7 @@ func TestZenodoRemote(t *testing.T) {
221222 assert .True (t , ok )
222223
223224 // Test reading the DOI files
224- o , err := fs .NewObject (context .Background (), "README.md" )
225+ o , err := f .NewObject (context .Background (), "README.md" )
225226 require .NoError (t , err )
226227 assert .Equal (t , int64 (18 ), o .Size ())
227228 md5Hash , err := o .Hash (context .Background (), hash .MD5 )
@@ -233,8 +234,11 @@ func TestZenodoRemote(t *testing.T) {
233234 require .NoError (t , err )
234235 require .NoError (t , fd .Close ())
235236 assert .Equal (t , []byte (files ["README.md" ]), data )
237+ do , ok := o .(fs.MimeTyper )
238+ require .True (t , ok )
239+ assert .Equal (t , "text/plain; charset=utf-8" , do .MimeType (context .Background ()))
236240
237- o , err = fs .NewObject (context .Background (), "data.txt" )
241+ o , err = f .NewObject (context .Background (), "data.txt" )
238242 require .NoError (t , err )
239243 assert .Equal (t , int64 (9 ), o .Size ())
240244 md5Hash , err = o .Hash (context .Background (), hash .MD5 )
@@ -246,4 +250,7 @@ func TestZenodoRemote(t *testing.T) {
246250 require .NoError (t , err )
247251 require .NoError (t , fd .Close ())
248252 assert .Equal (t , []byte (files ["data.txt" ]), data )
253+ do , ok = o .(fs.MimeTyper )
254+ require .True (t , ok )
255+ assert .Equal (t , "text/plain; charset=utf-8" , do .MimeType (context .Background ()))
249256}
0 commit comments