From b62eb70036562d15388c82ebd785bc5c4a07053d Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 4 Jun 2024 15:57:00 -0400 Subject: [PATCH] Server stdin migration: shear --- src/sync/client.go | 3 +-- src/sync/common.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sync/client.go b/src/sync/client.go index 8f91bcc..b4cb897 100644 --- a/src/sync/client.go +++ b/src/sync/client.go @@ -376,8 +376,7 @@ func ShearRemoteFromClient(targetLocationIncomplete string) { deviceID := ShearLocal(targetLocationIncomplete, "") // remove the target from the local system and get the device ID of the client // call the server to remotely shear the target and add it to the deletions list - // deviceID and targetLocationIncomplete are separated by \x1d, path separators are replaced with \x1e, and spaces are replaced with \x1f TODO is there a need to combine deviceID and targetLocationIncomplete into one argument? - GetSSHOutput("libmuttonserver shear "+deviceID+"\x1d"+strings.ReplaceAll(strings.ReplaceAll(targetLocationIncomplete, backend.PathSeparator, "\x1e"), " ", "\x1f"), "", false) + GetSSHOutput("libmuttonserver shear", deviceID+"\n"+strings.ReplaceAll(targetLocationIncomplete, backend.PathSeparator, "\x1d"), false) os.Exit(0) // sync is not required after shearing since the target has already been removed from the local system } diff --git a/src/sync/common.go b/src/sync/common.go index 83c7c33..f833338 100644 --- a/src/sync/common.go +++ b/src/sync/common.go @@ -40,7 +40,7 @@ func ShearLocal(targetLocationIncomplete, clientDeviceID string) string { if onServer { for _, device := range deviceIDList { if device.Name() != clientDeviceID { - _, err = os.Create(backend.ConfigDir + backend.PathSeparator + "deletions" + backend.PathSeparator + device.Name() + "\x1d" + strings.ReplaceAll(targetLocationIncomplete, backend.PathSeparator, "\x1e")) + _, err = os.Create(backend.ConfigDir + backend.PathSeparator + "deletions" + backend.PathSeparator + device.Name() + "\x1d" + strings.ReplaceAll(targetLocationIncomplete, "/", "\x1e")) if err != nil { // do not print error as there is currently no way of seeing server-side errors // failure to add the target to the deletions list will exit the program and result in a client re-uploading the target (non-critical)