From abb2b65c6977f549984d663bb1f391bbdda99f56 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Wed, 10 Jul 2024 02:07:59 -0400 Subject: [PATCH] Fix "shear" throwing errors if no device ID is present (instead of running in offline mode) --- src/sync/client.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sync/client.go b/src/sync/client.go index 636ee9e..5b06bdc 100644 --- a/src/sync/client.go +++ b/src/sync/client.go @@ -389,8 +389,11 @@ func deletionSync(deletions []string) { 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 - GetSSHOutput("libmuttonserver shear", deviceID+"\n"+strings.ReplaceAll(targetLocationIncomplete, backend.PathSeparator, "\x1d"), false) + if deviceID != "" { // ensure a device ID exists (online mode) + // call the server to remotely shear the target and add it to the deletions list + GetSSHOutput("libmuttonserver shear", deviceID+"\n"+ + strings.ReplaceAll(targetLocationIncomplete, backend.PathSeparator, "\x1d"), false) + } backend.Exit(0) // sync is not required after shearing since the target has already been removed from the local system } @@ -408,7 +411,7 @@ func RenameRemoteFromClient(oldLocationIncomplete, newLocationIncomplete string) strings.ReplaceAll(oldLocationIncomplete, backend.PathSeparator, "\x1d")+"\n"+ strings.ReplaceAll(newLocationIncomplete, backend.PathSeparator, "\x1d"), false) } - + backend.Exit(0) }