Skip to content

Commit 6970d69

Browse files
committed
fix: pass Archive and FollowLinks to recursive directory copy
1 parent 3fc21a9 commit 6970d69

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/cp.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func CpToInstance(ctx context.Context, cfg CpConfig, opts CpToInstanceOptions) e
201201
}
202202

203203
if srcInfo.IsDir() {
204-
return copyDirToWs(ctx, cfg, ws, opts.SrcPath, opts.DstPath, opts.InstanceID, opts.Callbacks)
204+
return copyDirToWs(ctx, cfg, ws, opts.SrcPath, opts.DstPath, opts.InstanceID, opts.Archive, opts.FollowLinks, opts.Callbacks)
205205
}
206206
return copyFileToWs(ws, opts.SrcPath, srcInfo.Size(), opts.Callbacks)
207207
}
@@ -271,7 +271,7 @@ func copyFileToWs(ws WsConn, srcPath string, size int64, callbacks *CpCallbacks)
271271
}
272272

273273
// copyDirToWs copies a directory to the WebSocket
274-
func copyDirToWs(ctx context.Context, cfg CpConfig, ws WsConn, srcPath, dstPath, instanceID string, callbacks *CpCallbacks) error {
274+
func copyDirToWs(ctx context.Context, cfg CpConfig, ws WsConn, srcPath, dstPath, instanceID string, archive, followLinks bool, callbacks *CpCallbacks) error {
275275
// For directory copy, we just send the end marker
276276
// The server will create the directory
277277
endMsg, _ := json.Marshal(map[string]string{"type": "end"})
@@ -320,11 +320,13 @@ func copyDirToWs(ctx context.Context, cfg CpConfig, ws WsConn, srcPath, dstPath,
320320
// For each file/dir, we need a new WebSocket connection
321321
// This is because the protocol is one-file-per-connection
322322
return CpToInstance(ctx, cfg, CpToInstanceOptions{
323-
InstanceID: instanceID,
324-
SrcPath: walkPath,
325-
DstPath: targetPath,
326-
Mode: info.Mode().Perm(),
327-
Callbacks: callbacks,
323+
InstanceID: instanceID,
324+
SrcPath: walkPath,
325+
DstPath: targetPath,
326+
Mode: info.Mode().Perm(),
327+
Archive: archive,
328+
FollowLinks: followLinks,
329+
Callbacks: callbacks,
328330
})
329331
})
330332
}

0 commit comments

Comments
 (0)