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

jottacloud: return direct download link from rclone link command

albertonyb868561951ff
diff --git a/backend/jottacloud/api/types.go b/backend/jottacloud/api/types.go
index 993f8e6e3..83dbf01a8 100644
--- a/backend/jottacloud/api/types.go
+++ b/backend/jottacloud/api/types.go
@@ -368,6 +368,7 @@ type JottaFile struct {
XMLName xml.Name
Name string `xml:"name,attr"`
Deleted Flag `xml:"deleted,attr"`
+ PublicURI string `xml:"publicURI"`
PublicSharePath string `xml:"publicSharePath"`
State string `xml:"currentRevision>state"`
CreatedAt Time `xml:"currentRevision>created"`
diff --git a/backend/jottacloud/jottacloud.go b/backend/jottacloud/jottacloud.go
index 85db2f9e1..7f6d1972d 100644
--- a/backend/jottacloud/jottacloud.go
+++ b/backend/jottacloud/jottacloud.go
@@ -1261,15 +1261,23 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration,
return "", errors.Wrap(err, "couldn't create public link")
}
if unlink {
- if result.PublicSharePath != "" {
- return "", errors.Errorf("couldn't remove public link - %q", result.PublicSharePath)
+ if result.PublicURI != "" {
+ return "", errors.Errorf("couldn't remove public link - %q", result.PublicURI)
}
return "", nil
}
- if result.PublicSharePath == "" {
- return "", errors.New("couldn't create public link - no link path received")
+ if result.PublicURI == "" {
+ return "", errors.New("couldn't create public link - no uri received")
}
- return joinPath(baseURL, result.PublicSharePath), nil
+ if result.PublicSharePath != "" {
+ webLink := joinPath(baseURL, result.PublicSharePath)
+ fs.Debugf(nil, "Web link: %s", webLink)
+ } else {
+ fs.Debugf(nil, "No web link received")
+ }
+ directLink := joinPath(baseURL, fmt.Sprintf("opin/io/downloadPublic/%s/%s", f.user, result.PublicURI))
+ fs.Debugf(nil, "Direct link: %s", directLink)
+ return directLink, nil
}
// About gets quota information