From fba3fb6d3d697df0f835d01573638997e7ba06a5 Mon Sep 17 00:00:00 2001 From: dougal Date: Mon, 8 Dec 2025 18:00:17 +0000 Subject: [PATCH] support mimetype --- backend/drime/drime.go | 83 +++++------------------------------------- 1 file changed, 9 insertions(+), 74 deletions(-) diff --git a/backend/drime/drime.go b/backend/drime/drime.go index f2f527a26..64da00d1d 100644 --- a/backend/drime/drime.go +++ b/backend/drime/drime.go @@ -295,8 +295,8 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e // CaseInsensitive: false, // CanHaveEmptyDirectories: true, // DuplicateFiles: true, - // ReadMimeType: true, - // WriteMimeType: false, + ReadMimeType: true, + WriteMimeType: true, // WriteDirSetModTime: true, // DirModTimeUpdatesOnWrite: true, }).Fill(ctx, f) @@ -1445,6 +1445,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op }, MultipartContentName: "file", MultipartFileName: encodedLeaf, + MultipartContentType: fs.MimeType(ctx, src), Path: "/uploads", Options: options, } @@ -1469,9 +1470,9 @@ func (o *Object) ID() string { } // MimeType returns the content type of the Object if known, or "" if not -// func (o *Object) MimeType(ctx context.Context) string { -// return o.mimeType -// } +func (o *Object) MimeType(ctx context.Context) string { + return o.mimeType +} // ParentID returns the ID of the Object parent if known, or "" if not func (o *Object) ParentID() string { @@ -1492,73 +1493,7 @@ var ( //_ fs.MergeDirser = (*Fs)(nil) // _ fs.DirSetModTimer = (*Fs)(nil) // _ fs.ListRer = (*Fs)(nil) - _ fs.Object = (*Object)(nil) - _ fs.IDer = (*Object)(nil) - // _ fs.MimeTyper = (*Object)(nil) + _ fs.Object = (*Object)(nil) + _ fs.IDer = (*Object)(nil) + _ fs.MimeTyper = (*Object)(nil) ) - -/* -{ - "current_page": 1, - "data": [ - { - "id": 483924217, - "name": "go.sum", - "description": null, - "file_name": "7adf30be-2fe2-4f20-87ba-fa4e9d51e482", - "mime": "application/octet-stream", - "color": null, - "backup": false, - "tracked": 0, - "file_size": 108408, - "user_id": null, - "parent_id": 483924168, - "created_at": "2025-12-02T18:36:00.000000Z", - "updated_at": "2025-12-03T09:03:26.000000Z", - "deleted_at": null, - "is_deleted": 0, - "path": "483924168/483924217", - "disk_prefix": "7adf30be-2fe2-4f20-87ba-fa4e9d51e482", - "type": "file", - "extension": "sum", - "file_hash": null, - "public": false, - "thumbnail": false, - "mux_status": null, - "thumbnail_url": null, - "workspace_id": 0, - "is_encrypted": 0, - "iv": null, - "vault_id": null, - "owner_id": 19984, - "hash": "NDgzOTI0MjE3fA", - "url": "api/v1/file-entries/483924217", - "users": [ - { - "email": "support@rclone.com", - "id": 19984, - "avatar": "https://www.gravatar.com/avatar/03a1d0a602fe31ddbaad590c21c988b8?s=&d=retro", - "model_type": "user", - "owns_entry": true, - "entry_permissions": [], - "display_name": "support" - } - ], - "tags": [], - "permissions": { - "files.update": true, - "files.create": true, - "files.download": true, - "files.delete": true - } - } - ], - "from": 1, - "last_page": 1, - "next_page": null, - "per_page": 1000, - "prev_page": null, - "to": 1, - "total": 1 -} -*/