Skip to content

Commit 9d9daa9

Browse files
Merge pull request #1784 from wagiejack/feature/path_preservation
added preservePath option for Operation requests
2 parents 385033d + d8975b1 commit 9d9daa9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

zboxcore/sdk/allocation.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ type OperationRequest struct {
343343
IsRepair bool // Required for repair operation
344344
IsWebstreaming bool
345345
EncryptedKey string
346+
PreservePath bool `json:"-"` //Required to preserve the original path fo the file, false if no value is provided
346347

347348
// Required for uploads
348349
Workdir string
@@ -1114,10 +1115,12 @@ func (a *Allocation) DoMultiOperation(operations []OperationRequest, opts ...Mul
11141115
break
11151116
}
11161117
op := operations[i]
1117-
op.RemotePath = strings.TrimSpace(op.RemotePath)
1118-
if op.FileMeta.RemotePath != "" {
1119-
op.FileMeta.RemotePath = strings.TrimSpace(op.FileMeta.RemotePath)
1120-
op.FileMeta.RemoteName = strings.TrimSpace(op.FileMeta.RemoteName)
1118+
if !op.PreservePath {
1119+
op.RemotePath = strings.TrimSpace(op.RemotePath)
1120+
if op.FileMeta.RemotePath != "" {
1121+
op.FileMeta.RemotePath = strings.TrimSpace(op.FileMeta.RemotePath)
1122+
op.FileMeta.RemoteName = strings.TrimSpace(op.FileMeta.RemoteName)
1123+
}
11211124
}
11221125
remotePath := op.RemotePath
11231126
parentPaths := GenerateParentPaths(remotePath)

0 commit comments

Comments
 (0)