Remove poorly placed "verifyEntryDoesNotExist" check, as clients should be responsible for performing this check long before attempting to write the entry

This commit is contained in:
2025-01-18 19:29:15 -05:00
parent 55be8a3075
commit fb5449cf1f
+1 -9
View File
@@ -39,15 +39,7 @@ func TargetIsFile(targetLocation string, errorOnFail bool, failCondition uint8)
}
// WriteEntry writes entryData to an encrypted file at targetLocation.
func WriteEntry(targetLocation string, entryData []string, verifyEntryDoesNotExist bool) {
if verifyEntryDoesNotExist {
_, isAccessible := TargetIsFile(targetLocation, false, 0)
if isAccessible {
fmt.Println(AnsiError + "Target location already exists" + AnsiReset)
os.Exit(ErrorTargetExists)
}
}
func WriteEntry(targetLocation string, entryData []string) {
encryptedBytes := EncryptGPG(entryData)
err := os.WriteFile(targetLocation, encryptedBytes, 0600)
if err != nil {