From e294306c446bb34428f76f889b2d486b3c5a2a85 Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Wed, 12 Jul 2023 13:14:53 +0200 Subject: [PATCH] Fix default MIME type bug --- file.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/file.go b/file.go index 96eca07..25667e7 100644 --- a/file.go +++ b/file.go @@ -381,6 +381,10 @@ func (protonDrive *ProtonDrive) uploadFile(ctx context.Context, parentLink *prot // detect MIME type by looking at the filename only mimeType := mime.TypeByExtension(filepath.Ext(filename)) + if mimeType == "" { + // api requires a mime type passed in + mimeType = "text/plain" + } /* step 1: create a draft */ link, createFileResp, newSessionKey, newNodeKR, err := protonDrive.createFileUploadDraft(ctx, parentLink, filename, modTime, mimeType)