From 093177705469266b05105594fd25097a6253d6af Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Mon, 31 May 2021 15:51:16 -0400 Subject: [PATCH] Added check to make the trash directory if the users is moving a file object to trash and the trash directory is missing. --- stochss/handlers/util/stochss_base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stochss/handlers/util/stochss_base.py b/stochss/handlers/util/stochss_base.py index 8b6b7478fb..c17075e87f 100644 --- a/stochss/handlers/util/stochss_base.py +++ b/stochss/handlers/util/stochss_base.py @@ -97,6 +97,8 @@ def get_new_path(self, dst_path): New path for the file object from the users home directory ''' new_path = os.path.join(self.user_dir, dst_path) + if dst_path.startswith("trash/") and not "trash" in os.listdir(self.user_dir): + os.mkdir(os.path.join(self.user_dir, "trash")) if new_path.split().pop().replace('.', '', 5).isdigit(): return new_path.replace(new_path.split().pop(), "").strip() if "trash/" in new_path and os.path.exists(new_path):