From ac6f6f279fbca6143b65cd7960cdd5e2bf06b829 Mon Sep 17 00:00:00 2001 From: Cuan Date: Mon, 10 Jan 2022 09:39:29 -0500 Subject: [PATCH] Fixed editing a file that doesn't exist --- bin/sshyp | 4 ++++ share/doc/sshyp/changelog | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/sshyp b/bin/sshyp index 61a5cd2..ea0f011 100755 --- a/bin/sshyp +++ b/bin/sshyp @@ -5,6 +5,7 @@ from os import environ, mkdir, remove, system from shutil import copy, move, rmtree from sys import argv, exit as s_exit +from pathlib import Path import random import sshync import string @@ -258,6 +259,9 @@ def edit(): # edits the contents of an entry _entry_name = _entry_name.replace('/', '', 1) _shm_folder, _shm_entry = shm_gen() system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'") + if not Path(f"/dev/shm/{_shm_folder}/{_shm_entry}").is_file(): + print("\nYou are trying to edit a file that does not exist!\n") + s_exit() if argument == 'edit username' or argument == 'edit -u': _detail = str(input('New Username: ')) replace_line(f"/dev/shm/{_shm_folder}/{_shm_entry}", 0, _detail + '\n') diff --git a/share/doc/sshyp/changelog b/share/doc/sshyp/changelog index 248e302..3b8d841 100644 --- a/share/doc/sshyp/changelog +++ b/share/doc/sshyp/changelog @@ -1,4 +1,4 @@ -sshyp 2021.12.04.fr2.3 +sshyp 2022.01.10.fr2.3 The Lighter Update - Patch 3 @@ -16,7 +16,7 @@ Changes: ** folders generated in /dev/shm are once again properly deleted with keyboard interrupts - .lower() is now used to remove casing when checking inputs - fixed syncing of files (specifically downloading) with special characters, such as '(' -** fixed program still continuing after trying to edit an entry that doesn't exist +- fixed program still continuing after trying to edit an entry that doesn't exist - removed an old reference to "rsync" in the configuration dialog Planned for next major update (The Fluffier Update):