diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 18e29d251..1ff28a434 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -1597,6 +1597,15 @@ func (f *Fs) findExportFormatByMimeType(ctx context.Context, itemMimeType string } } + // If using a link type export and a more specific export + // hasn't been found all docs should be exported + for _, _extension := range f.exportExtensions { + _mimeType := mime.TypeByExtension(_extension) + if isLinkMimeType(_mimeType) { + return _extension, _mimeType, true + } + } + // else return empty return "", "", isDocument } @@ -1607,6 +1616,14 @@ func (f *Fs) findExportFormatByMimeType(ctx context.Context, itemMimeType string // Look through the exportExtensions and find the first format that can be // converted. If none found then return ("", "", "", false) func (f *Fs) findExportFormat(ctx context.Context, item *drive.File) (extension, filename, mimeType string, isDocument bool) { + // If item has MD5 sum it is a file stored on drive + if item.Md5Checksum != "" { + return + } + // Folders can't be documents + if item.MimeType == driveFolderType { + return + } extension, mimeType, isDocument = f.findExportFormatByMimeType(ctx, item.MimeType) if extension != "" { filename = item.Name + extension