drive: add support for apps-script to json export

This commit is contained in:
Fabian Möller 2018-08-30 18:03:48 +02:00 committed by Nick Craig-Wood
parent 80b25daac7
commit 15b1a1f909
2 changed files with 8 additions and 1 deletions

View File

@ -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
}
}
}

View File

@ -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 |