Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

jottacloud: Add optional MimeTyper interface.

Sebastian Bünger86e3436d5538
diff --git a/backend/jottacloud/api/types.go b/backend/jottacloud/api/types.go
index 2f2ae0dfb..22d7d711e 100644
--- a/backend/jottacloud/api/types.go
+++ b/backend/jottacloud/api/types.go
@@ -241,6 +241,7 @@ type JottaFile struct {
ModifiedAt Time `xml:"currentRevision>modified"`
Updated Time `xml:"currentRevision>updated"`
Size int64 `xml:"currentRevision>size"`
+ MimeType string `xml:"currentRevision>mime"`
MD5 string `xml:"currentRevision>md5"`
}
diff --git a/backend/jottacloud/jottacloud.go b/backend/jottacloud/jottacloud.go
index 59a8ba697..8fd62d41e 100644
--- a/backend/jottacloud/jottacloud.go
+++ b/backend/jottacloud/jottacloud.go
@@ -104,6 +104,7 @@ type Object struct {
size int64
modTime time.Time
md5 string
+ mimeType string
}
// ------------------------------------------------------------
@@ -688,11 +689,17 @@ func (o *Object) Size() int64 {
return o.size
}
+// MimeType of an Object if known, "" otherwise
+func (o *Object) MimeType() string {
+ return o.mimeType
+}
+
// setMetaData sets the metadata from info
func (o *Object) setMetaData(info *api.JottaFile) (err error) {
o.hasMetaData = true
o.size = int64(info.Size)
o.md5 = info.MD5
+ o.mimeType = info.MimeType
o.modTime = time.Time(info.ModifiedAt)
return nil
}
@@ -891,10 +898,11 @@ func (o *Object) Remove() error {
// Check the interfaces are satisfied
var (
- _ fs.Fs = (*Fs)(nil)
- _ fs.Purger = (*Fs)(nil)
- _ fs.Copier = (*Fs)(nil)
- _ fs.Mover = (*Fs)(nil)
- _ fs.DirMover = (*Fs)(nil)
- _ fs.Object = (*Object)(nil)
+ _ fs.Fs = (*Fs)(nil)
+ _ fs.Purger = (*Fs)(nil)
+ _ fs.Copier = (*Fs)(nil)
+ _ fs.Mover = (*Fs)(nil)
+ _ fs.DirMover = (*Fs)(nil)
+ _ fs.Object = (*Object)(nil)
+ _ fs.MimeTyper = (*Object)(nil)
)