mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-12-05 01:10:15 +00:00
Fix bad parameter in delete call on import dir cleanup
This commit is contained in:
@@ -5,6 +5,7 @@ import threading
|
||||
import asyncio
|
||||
import datetime
|
||||
import json
|
||||
from pathlib import Path
|
||||
from zoneinfo import ZoneInfoNotFoundError
|
||||
from tzlocal import get_localzone
|
||||
from apscheduler.events import EVENT_JOB_EXECUTED
|
||||
@@ -815,15 +816,16 @@ class TasksManager:
|
||||
os.remove(os.path.join(file))
|
||||
except FileNotFoundError:
|
||||
logger.debug("Could not clear out file from temp directory")
|
||||
|
||||
for file in os.listdir(
|
||||
os.path.join(self.controller.project_root, "import", "upload")
|
||||
):
|
||||
if self.helper.is_file_older_than_x_days(
|
||||
os.path.join(self.controller.project_root, "import", "upload", file)
|
||||
):
|
||||
import_path = Path(self.controller.project_root, "import", "upload")
|
||||
for file in os.listdir(import_path):
|
||||
file_path = Path(import_path, file).resolve(strict=True)
|
||||
if not self.helper.validate_traversal(import_path, file_path):
|
||||
logger.error(
|
||||
"Traversal detected while deleting import file %s", file_path
|
||||
)
|
||||
if self.helper.is_file_older_than_x_days(Path(import_path, file)):
|
||||
try:
|
||||
os.remove(os.path.join(file))
|
||||
os.remove(Path(import_path, file))
|
||||
except FileNotFoundError:
|
||||
logger.debug("Could not clear out file from import directory")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user