diff --git a/go.mod b/go.mod index d955843..baf5360 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.24.3 require ( github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514 github.com/charmbracelet/glamour v0.7.0 - github.com/rwinkhart/go-boilerplate v0.0.0-20250601181619-e38a47784de0 - github.com/rwinkhart/libmutton v0.3.2-0.20250601181751-5f8789a0f018 + github.com/rwinkhart/go-boilerplate v0.0.0-20250601184813-71b5056ca6b3 + github.com/rwinkhart/libmutton v0.3.2-0.20250601192431-d0f7b663d50f golang.org/x/term v0.32.0 ) diff --git a/go.sum b/go.sum index 20071f5..e549f4d 100644 --- a/go.sum +++ b/go.sum @@ -57,12 +57,12 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rwinkhart/convertroman v0.2.0 h1:otUm939eXT77q/Lr31mJtMwVWEw0RjEUB71gO65h9OM= github.com/rwinkhart/convertroman v0.2.0/go.mod h1:Af6HqvX0EIM4Y3HcnNXbbRey1dLasGB7WU0+3Cowgmw= -github.com/rwinkhart/go-boilerplate v0.0.0-20250601181619-e38a47784de0 h1:Zuwn0er30tMYrBXD1n4nM3mkGhrLFAdn3sZyMHkxx2I= -github.com/rwinkhart/go-boilerplate v0.0.0-20250601181619-e38a47784de0/go.mod h1:cnzIF45I0FCOvE4YIB+26pLCUx2kWyY2llKYZruNaRY= +github.com/rwinkhart/go-boilerplate v0.0.0-20250601184813-71b5056ca6b3 h1:QgmV+Om1Z1Ix+nO6k9RRIzLpevkeeyrmCspIKysvsc4= +github.com/rwinkhart/go-boilerplate v0.0.0-20250601184813-71b5056ca6b3/go.mod h1:cnzIF45I0FCOvE4YIB+26pLCUx2kWyY2llKYZruNaRY= github.com/rwinkhart/go-winio-easy-pipe-handles v0.0.0-20250407031321-96994a0e8410 h1:NhHwFM3Pgm6zRUfFKvi0p5ndjfFbVWsRwmmhyFlG4PE= github.com/rwinkhart/go-winio-easy-pipe-handles v0.0.0-20250407031321-96994a0e8410/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/rwinkhart/libmutton v0.3.2-0.20250601181751-5f8789a0f018 h1:SpVerjfORaFmFep1s22YxqxDdJDd+VhGotsNbcOnX40= -github.com/rwinkhart/libmutton v0.3.2-0.20250601181751-5f8789a0f018/go.mod h1:KsTWIJIHZdtDsFNAxJ0Xjpfy0mEVks5EWatswZWgdn0= +github.com/rwinkhart/libmutton v0.3.2-0.20250601192431-d0f7b663d50f h1:iNnwR3fXbg3/4hSc4Wh5Jg46dWJsgMJ+6tawvQvolg8= +github.com/rwinkhart/libmutton v0.3.2-0.20250601192431-d0f7b663d50f/go.mod h1:npc39dSGbmN6s4XFIi1KKlKQ2PD61fz54WcvJHfMx3o= github.com/rwinkhart/peercred-mini v0.1.0 h1:TiS6u8cEWzW55S9X4iVpU72Iuy/NG6rMUJMtUEVEFLw= github.com/rwinkhart/peercred-mini v0.1.0/go.mod h1:+x4Mxc2veE+YePSOpcUasjimh7n799c1KraLuQwHR20= github.com/rwinkhart/rcw v0.2.0 h1:/rFgJ+20OSThipKAX5KPwW2xbPpgh1zl49THmEkkPis= diff --git a/mutn.go b/mutn.go index 7fe0b46..91ce005 100644 --- a/mutn.go +++ b/mutn.go @@ -114,8 +114,11 @@ func main() { case "note", "-n": field = 4 case "rename", "-r": - back.TargetIsFile(targetLocation, true, 0) // ensure location exists before prompting for new location - cli.RenameCli(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory + isAccessible, _ := back.TargetIsFile(targetLocation, true) // error is ignored because dir/file status is irrelevant + if !isAccessible { + other.PrintError("Failed to access location ("+targetLocation+")", back.ErrorTargetNotFound, true) + } + cli.RenameCli(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory default: cli.HelpEdit() } diff --git a/src/cli/entryReader.go b/src/cli/entryReader.go index 18ba51b..17ad456 100644 --- a/src/cli/entryReader.go +++ b/src/cli/entryReader.go @@ -78,16 +78,14 @@ fieldLoop: // EntryReaderDecrypt is a wrapper for EntryReader that first decrypts an RCW-wrapped file before sending it to EntryReader. func EntryReaderDecrypt(targetLocation string, hideSecrets bool) { - isFile, _, err := back.TargetIsFile(targetLocation, true, 2) - if err != nil { + _, err := back.TargetIsFile(targetLocation, true) + if err != nil { // if the location does not exist or is a directory... other.PrintError("Failed to verify target location: "+err.Error(), back.ErrorTargetNotFound, true) } - if isFile { - decBytes, err := crypt.DecryptFileToSlice(targetLocation) - if err != nil { - other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption, true) - } - EntryReader(decBytes, hideSecrets, false) // never sync if decrypting straight to EntryReader, as this means the entry could not have been modified + decBytes, err := crypt.DecryptFileToSlice(targetLocation) + if err != nil { + other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption, true) } + EntryReader(decBytes, hideSecrets, false) // never sync if decrypting straight to EntryReader, as this means the entry could not have been modified // do not exit, as this is the job of EntryReader }