From 8a72840de0c5287803a530b54c0c09e9e371fd28 Mon Sep 17 00:00:00 2001 From: Michael H Date: Sat, 29 Jun 2019 10:45:44 -0400 Subject: [PATCH] [Utils] Modify chmod use in `safe_delete` (#2701) - Takes a pessmisitc approach that it's possible chmod succeeds, but deletion fails and does not make the entire dir world writeable --- redbot/core/utils/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redbot/core/utils/__init__.py b/redbot/core/utils/__init__.py index 00a87d299..4dc805109 100644 --- a/redbot/core/utils/__init__.py +++ b/redbot/core/utils/__init__.py @@ -62,13 +62,13 @@ logging.getLogger().addFilter(_fuzzy_log_filter) def safe_delete(pth: Path): if pth.exists(): for root, dirs, files in os.walk(str(pth)): - os.chmod(root, 0o755) + os.chmod(root, 0o700) for d in dirs: - os.chmod(os.path.join(root, d), 0o755) + os.chmod(os.path.join(root, d), 0o700) for f in files: - os.chmod(os.path.join(root, f), 0o755) + os.chmod(os.path.join(root, f), 0o700) shutil.rmtree(str(pth), ignore_errors=True)