Fixed critical issues relating to encryption, including misplaced files
and failure to erase temporary files.
This commit is contained in:
@@ -17,7 +17,7 @@ fi
|
||||
# If encryption is enabled, decrypt $NOTE to a temp file, otherwise
|
||||
# operate on the note directly.
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
cp "$NOTES_DIR/$NOTE" "$NOTES_DIR$/$NOTE".bk #Insurance
|
||||
cp "$NOTES_DIR/$NOTE" "$NOTES_DIR/$NOTE.bk" #Insurance
|
||||
TMP_NOTE="$TMP_DIR/$SESSION_ID"
|
||||
decrypt > "$TMP_NOTE"
|
||||
else
|
||||
@@ -26,7 +26,7 @@ fi
|
||||
|
||||
# Write an ammendment header
|
||||
if [ -z "$CREATE" ]; then
|
||||
printf "\n%s\n" "edit - $(date $DATE_FMT)" >> "$TMP_NOTE"
|
||||
printf "\n%s\n" "edit - $(date "$DATE_FMT")" >> "$TMP_NOTE"
|
||||
printf "%s\n" "===================================" >> "$TMP_NOTE"
|
||||
fi
|
||||
|
||||
@@ -36,9 +36,11 @@ printf " - %s\n" "editing ${NOTE%.*}"
|
||||
|
||||
# If the file was previously decrypted, encrypt it back
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
echo "reencrypting"
|
||||
rm "$NOTES_DIR/$NOTE"
|
||||
encrypt;
|
||||
if [ ! -r "$NOTE" ]; then
|
||||
rm "$TMP_NOTE"
|
||||
if [ ! -r "$NOTES_DIR/$NOTE" ]; then
|
||||
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n" "error: note was not saved."
|
||||
cp "$NOTES_DIR/$NOTE.bk" "$NOTES_DIR/$NOTE"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user