Fixed editing a file that doesn't exist

This commit is contained in:
2022-01-10 09:39:29 -05:00
parent 019aa58411
commit ac6f6f279f
2 changed files with 6 additions and 2 deletions
+4
View File
@@ -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')
+2 -2
View File
@@ -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):