Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

drive: Remove --drive-alternate-export in favor of exportLinks

themylogin57c10babfe21
diff --git a/backend/drive/drive.go b/backend/drive/drive.go
index 8e5f4b09f..2e4b6cb16 100755
--- a/backend/drive/drive.go
+++ b/backend/drive/drive.go
@@ -17,7 +17,6 @@ import (
"log"
"mime"
"net/http"
- "net/url"
"path"
"sort"
"strconv"
@@ -70,7 +69,7 @@ const (
// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
minChunkSize = 256 * fs.KibiByte
defaultChunkSize = 8 * fs.MebiByte
- partialFields = "id,name,size,md5Checksum,trashed,explicitlyTrashed,modifiedTime,createdTime,mimeType,parents,webViewLink,shortcutDetails"
+ partialFields = "id,name,size,md5Checksum,trashed,explicitlyTrashed,modifiedTime,createdTime,mimeType,parents,webViewLink,shortcutDetails,exportLinks"
listRGrouping = 50 // number of IDs to search at once when using ListR
listRInputBuffer = 1000 // size of input buffer when using ListR
)
@@ -354,17 +353,8 @@ date is used.`,
}, {
Name: "alternate_export",
Default: false,
- Help: `Use alternate export URLs for google documents export.,
-
-If this option is set this instructs rclone to use an alternate set of
-export URLs for drive documents. Users have reported that the
-official export URLs can't export large documents, whereas these
-unofficial ones can.
-
-See rclone issue [#2243](https://github.com/rclone/rclone/issues/2243) for background,
-[this google drive issue](https://issuetracker.google.com/issues/36761333) and
-[this helpful post](https://www.labnol.org/internet/direct-links-for-google-drive/28356/).`,
- Advanced: true,
+ Help: "Deprecated: no longer needed",
+ Hide: fs.OptionHideBoth,
}, {
Name: "upload_cutoff",
Default: defaultChunkSize,
@@ -527,7 +517,6 @@ type Options struct {
UseSharedDate bool `config:"use_shared_date"`
ListChunk int64 `config:"list_chunk"`
Impersonate string `config:"impersonate"`
- AlternateExport bool `config:"alternate_export"`
UploadCutoff fs.SizeSuffix `config:"upload_cutoff"`
ChunkSize fs.SizeSuffix `config:"chunk_size"`
AcknowledgeAbuse bool `config:"acknowledge_abuse"`
@@ -1253,20 +1242,7 @@ func (f *Fs) newDocumentObject(remote string, info *drive.File, extension, expor
if err != nil {
return nil, err
}
- id := actualID(info.Id)
- url := fmt.Sprintf("%sfiles/%s/export?mimeType=%s", f.svc.BasePath, id, url.QueryEscape(mediaType))
- if f.opt.AlternateExport {
- switch info.MimeType {
- case "application/vnd.google-apps.drawing":
- url = fmt.Sprintf("https://docs.google.com/drawings/d/%s/export/%s", id, extension[1:])
- case "application/vnd.google-apps.document":
- url = fmt.Sprintf("https://docs.google.com/document/d/%s/export?format=%s", id, extension[1:])
- case "application/vnd.google-apps.spreadsheet":
- url = fmt.Sprintf("https://docs.google.com/spreadsheets/d/%s/export?format=%s", id, extension[1:])
- case "application/vnd.google-apps.presentation":
- url = fmt.Sprintf("https://docs.google.com/presentation/d/%s/export/%s", id, extension[1:])
- }
- }
+ url := info.ExportLinks[mediaType]
baseObject := f.newBaseObject(remote+extension, info)
baseObject.bytes = -1
baseObject.mimeType = exportMimeType
diff --git a/docs/content/drive.md b/docs/content/drive.md
index 05a5c1660..c5bbd0393 100644
--- a/docs/content/drive.md
+++ b/docs/content/drive.md
@@ -813,24 +813,6 @@ Impersonate this user when using a service account.
- Type: string
- Default: ""
-#### --drive-alternate-export
-
-Use alternate export URLs for google documents export.,
-
-If this option is set this instructs rclone to use an alternate set of
-export URLs for drive documents. Users have reported that the
-official export URLs can't export large documents, whereas these
-unofficial ones can.
-
-See rclone issue [#2243](https://github.com/rclone/rclone/issues/2243) for background,
-[this google drive issue](https://issuetracker.google.com/issues/36761333) and
-[this helpful post](https://www.labnol.org/internet/direct-links-for-google-drive/28356/).
-
-- Config: alternate_export
-- Env Var: RCLONE_DRIVE_ALTERNATE_EXPORT
-- Type: bool
-- Default: false
-
#### --drive-upload-cutoff
Cutoff for switching to chunked upload