From 15b1a1f9096c1a48120635a67e60f23497c905e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Thu, 30 Aug 2018 18:03:48 +0200 Subject: [PATCH] drive: add support for apps-script to json export --- backend/drive/drive.go | 8 +++++++- docs/content/drive.md | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 70ec279b7..ec5e85a03 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -110,6 +110,9 @@ var ( "application/x-link-url": ".url", "application/x-link-webloc": ".webloc", } + _mimeTypeCustomTransform = map[string]string{ + "application/vnd.google-apps.script+json": "application/json", + } partialFields = "id,name,size,md5Checksum,trashed,modifiedTime,createdTime,mimeType,parents,webViewLink" fetchFormatsOnce sync.Once // make sure we fetch the export/import formats only once _exportFormats map[string][]string // allowed export MIME type conversions @@ -1135,7 +1138,10 @@ func (f *Fs) findExportFormatByMimeType(itemMimeType string) ( } for _, emt := range exportMimeTypes { if emt == _mimeType { - return _extension, _mimeType, true + return _extension, emt, true + } + if _mimeType == _mimeTypeCustomTransform[emt] { + return _extension, emt, true } } } diff --git a/docs/content/drive.md b/docs/content/drive.md index da3b0d08a..e707bf876 100644 --- a/docs/content/drive.md +++ b/docs/content/drive.md @@ -481,6 +481,7 @@ represent the currently available converions. | epub | application/epub+zip | E-book format | | html | text/html | An HTML Document | | jpg | image/jpeg | A JPEG Image File | +| json | application/vnd.google-apps.script+json | JSON Text Format | | odp | application/vnd.oasis.opendocument.presentation | Openoffice Presentation | | ods | application/vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet | | ods | application/x-vnd.oasis.opendocument.spreadsheet | Openoffice Spreadsheet |