link: allow creating public link to files and folders - closes #1562

This commit is contained in:
Stefan 2018-03-29 09:10:19 +02:00 committed by GitHub
parent 9df266a6b4
commit a8267d1628
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 275 additions and 41 deletions

View file

@ -1470,6 +1470,15 @@ func Rcat(fdst fs.Fs, dstFileName string, in io.ReadCloser, modTime time.Time) (
return dst, nil
}
// PublicLink adds a "readable by anyone with link" permission on the given file or folder.
func PublicLink(f fs.Fs, remote string) (string, error) {
doPublicLink := f.Features().PublicLink
if doPublicLink == nil {
return "", errors.Errorf("%v doesn't support public links", f)
}
return doPublicLink(remote)
}
// Rmdirs removes any empty directories (or directories only
// containing empty directories) under f, including f.
func Rmdirs(f fs.Fs, dir string, leaveRoot bool) error {