lsjson: added EncryptedPath to output - fixes #3094
This commit is contained in:
parent
f5795db6d2
commit
8190a81201
1 changed files with 14 additions and 12 deletions
|
@ -14,6 +14,7 @@ import (
|
||||||
type ListJSONItem struct {
|
type ListJSONItem struct {
|
||||||
Path string
|
Path string
|
||||||
Name string
|
Name string
|
||||||
|
EncryptedPath string `json:",omitempty"`
|
||||||
Encrypted string `json:",omitempty"`
|
Encrypted string `json:",omitempty"`
|
||||||
Size int64
|
Size int64
|
||||||
MimeType string `json:",omitempty"`
|
MimeType string `json:",omitempty"`
|
||||||
|
@ -118,12 +119,13 @@ func ListJSON(fsrc fs.Fs, remote string, opt *ListJSONOpt, callback func(*ListJS
|
||||||
if cipher != nil {
|
if cipher != nil {
|
||||||
switch entry.(type) {
|
switch entry.(type) {
|
||||||
case fs.Directory:
|
case fs.Directory:
|
||||||
item.Encrypted = cipher.EncryptDirName(path.Base(entry.Remote()))
|
item.EncryptedPath = cipher.EncryptDirName(entry.Remote())
|
||||||
case fs.Object:
|
case fs.Object:
|
||||||
item.Encrypted = cipher.EncryptFileName(path.Base(entry.Remote()))
|
item.EncryptedPath = cipher.EncryptFileName(entry.Remote())
|
||||||
default:
|
default:
|
||||||
fs.Errorf(nil, "Unknown type %T in listing", entry)
|
fs.Errorf(nil, "Unknown type %T in listing", entry)
|
||||||
}
|
}
|
||||||
|
item.Encrypted = path.Base(item.EncryptedPath)
|
||||||
}
|
}
|
||||||
if do, ok := entry.(fs.IDer); ok {
|
if do, ok := entry.(fs.IDer); ok {
|
||||||
item.ID = do.ID()
|
item.ID = do.ID()
|
||||||
|
|
Loading…
Reference in a new issue