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

lsjson: added EncryptedPath to output - fixes #3094

calisro8190a8120111
diff --git a/fs/operations/lsjson.go b/fs/operations/lsjson.go
index 876a71ef5..a9d8862e5 100644
--- a/fs/operations/lsjson.go
+++ b/fs/operations/lsjson.go
@@ -12,16 +12,17 @@ import (
// ListJSONItem in the struct which gets marshalled for each line
type ListJSONItem struct {
- Path string
- Name string
- Encrypted string `json:",omitempty"`
- Size int64
- MimeType string `json:",omitempty"`
- ModTime Timestamp //`json:",omitempty"`
- IsDir bool
- Hashes map[string]string `json:",omitempty"`
- ID string `json:",omitempty"`
- OrigID string `json:",omitempty"`
+ Path string
+ Name string
+ EncryptedPath string `json:",omitempty"`
+ Encrypted string `json:",omitempty"`
+ Size int64
+ MimeType string `json:",omitempty"`
+ ModTime Timestamp //`json:",omitempty"`
+ IsDir bool
+ Hashes map[string]string `json:",omitempty"`
+ ID string `json:",omitempty"`
+ OrigID string `json:",omitempty"`
}
// Timestamp a time in the provided format
@@ -118,12 +119,13 @@ func ListJSON(fsrc fs.Fs, remote string, opt *ListJSONOpt, callback func(*ListJS
if cipher != nil {
switch entry.(type) {
case fs.Directory:
- item.Encrypted = cipher.EncryptDirName(path.Base(entry.Remote()))
+ item.EncryptedPath = cipher.EncryptDirName(entry.Remote())
case fs.Object:
- item.Encrypted = cipher.EncryptFileName(path.Base(entry.Remote()))
+ item.EncryptedPath = cipher.EncryptFileName(entry.Remote())
default:
fs.Errorf(nil, "Unknown type %T in listing", entry)
}
+ item.Encrypted = path.Base(item.EncryptedPath)
}
if do, ok := entry.(fs.IDer); ok {
item.ID = do.ID()