drive: add --drive-show-all-gdocs to allow unexportable gdocs to be server side copied

Before this change, attempting to server side copy a google form would
give this error

    No export formats found for "application/vnd.google-apps.form"

Adding this flag allows the form to be server side copied but not
downloaded.

Fixes #6302
This commit is contained in:
Nick Craig-Wood 2023-09-25 15:18:40 +01:00
parent 4daf755da0
commit c5f6fc3283

View File

@ -320,6 +320,25 @@ rather than shortcuts themselves when doing server side copies.`,
Default: false, Default: false,
Help: "Skip google documents in all listings.\n\nIf given, gdocs practically become invisible to rclone.", Help: "Skip google documents in all listings.\n\nIf given, gdocs practically become invisible to rclone.",
Advanced: true, Advanced: true,
}, {
Name: "show_all_gdocs",
Default: false,
Help: `Show all Google Docs including non-exportable ones in listings.
If you try a server side copy on a Google Form without this flag, you
will get this error:
No export formats found for "application/vnd.google-apps.form"
However adding this flag will allow the form to be server side copied.
Note that rclone doesn't add extensions to the Google Docs file names
in this mode.
Do **not** use this flag when trying to download Google Docs - rclone
will fail to download them.
`,
Advanced: true,
}, { }, {
Name: "skip_checksum_gphotos", Name: "skip_checksum_gphotos",
Default: false, Default: false,
@ -667,6 +686,7 @@ type Options struct {
UseTrash bool `config:"use_trash"` UseTrash bool `config:"use_trash"`
CopyShortcutContent bool `config:"copy_shortcut_content"` CopyShortcutContent bool `config:"copy_shortcut_content"`
SkipGdocs bool `config:"skip_gdocs"` SkipGdocs bool `config:"skip_gdocs"`
ShowAllGdocs bool `config:"show_all_gdocs"`
SkipChecksumGphotos bool `config:"skip_checksum_gphotos"` SkipChecksumGphotos bool `config:"skip_checksum_gphotos"`
SharedWithMe bool `config:"shared_with_me"` SharedWithMe bool `config:"shared_with_me"`
TrashedOnly bool `config:"trashed_only"` TrashedOnly bool `config:"trashed_only"`
@ -1528,6 +1548,8 @@ func (f *Fs) newObjectWithExportInfo(
case f.opt.SkipGdocs: case f.opt.SkipGdocs:
fs.Debugf(remote, "Skipping google document type %q", info.MimeType) fs.Debugf(remote, "Skipping google document type %q", info.MimeType)
return nil, fs.ErrorObjectNotFound return nil, fs.ErrorObjectNotFound
case f.opt.ShowAllGdocs:
return f.newDocumentObject(remote, info, "", info.MimeType)
default: default:
// If item MimeType is in the ExportFormats then it is a google doc // If item MimeType is in the ExportFormats then it is a google doc
if !isDocument { if !isDocument {