jottacloud: return direct download link from rclone link command

If the shared path is a directory, then the download will be a zip archive.

Fixes #5391

See #5399
This commit is contained in:
albertony 2021-06-10 19:44:11 +02:00
parent 78db3dba0e
commit b868561951
2 changed files with 14 additions and 5 deletions

View File

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

View File

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