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

fs: make ConfigFs take an fs.Info which makes it more useful

Nick Craig-Wood021f25a748b5
diff --git a/fs/newfs.go b/fs/newfs.go
index 9be890ec7..6c20814ec 100644
--- a/fs/newfs.go
+++ b/fs/newfs.go
@@ -117,7 +117,7 @@ func ParseRemote(path string) (fsInfo *RegInfo, configName, fsPath string, conne
// configString returns a canonical version of the config string used
// to configure the Fs as passed to fs.NewFs
-func configString(f Fs, full bool) string {
+func configString(f Info, full bool) string {
name := f.Name()
if open := strings.IndexRune(name, '{'); full && open >= 0 && strings.HasSuffix(name, "}") {
suffix := name[open:]
@@ -140,10 +140,16 @@ func configString(f Fs, full bool) string {
// ConfigString returns a canonical version of the config string used
// to configure the Fs as passed to fs.NewFs. For Fs with extra
// parameters this will include a canonical {hexstring} suffix.
-func ConfigString(f Fs) string {
+func ConfigString(f Info) string {
return configString(f, false)
}
+// FullPath returns the full path with remote:path/to/object
+// for an object.
+func FullPath(o Object) string {
+ return fspath.JoinRootPath(ConfigString(o.Fs()), o.Remote())
+}
+
// ConfigStringFull returns a canonical version of the config string
// used to configure the Fs as passed to fs.NewFs. This string can be
// used to re-instantiate the Fs exactly so includes all the extra