🥅 Handle missing image file deletion
This commit is contained in:
parent
59af998b2f
commit
77cb4a0c1b
@ -34,7 +34,10 @@ def b64img_decode(data: str) -> bytes:
|
|||||||
|
|
||||||
def remove_image(path: str):
|
def remove_image(path: str):
|
||||||
try:
|
try:
|
||||||
Path(assets_folder_path() / path).unlink()
|
fpath = Path(assets_folder_path() / path)
|
||||||
|
if not fpath.exists():
|
||||||
|
return
|
||||||
|
fpath.unlink()
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
raise Exception("Error deleting image:", exc, path)
|
raise Exception("Error deleting image:", exc, path)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user