cleanup
This commit is contained in:
@@ -48,8 +48,22 @@ class SerieScanner:
|
||||
basePath: Base directory containing anime series
|
||||
loader: Loader instance for fetching series information
|
||||
callback_manager: Optional callback manager for progress updates
|
||||
|
||||
Raises:
|
||||
ValueError: If basePath is invalid or doesn't exist
|
||||
"""
|
||||
self.directory: str = basePath
|
||||
# Validate basePath to prevent directory traversal attacks
|
||||
if not basePath or not basePath.strip():
|
||||
raise ValueError("Base path cannot be empty")
|
||||
|
||||
# Resolve to absolute path and validate it exists
|
||||
abs_path = os.path.abspath(basePath)
|
||||
if not os.path.exists(abs_path):
|
||||
raise ValueError(f"Base path does not exist: {abs_path}")
|
||||
if not os.path.isdir(abs_path):
|
||||
raise ValueError(f"Base path is not a directory: {abs_path}")
|
||||
|
||||
self.directory: str = abs_path
|
||||
self.folderDict: dict[str, Serie] = {}
|
||||
self.loader: Loader = loader
|
||||
self._callback_manager: CallbackManager = (
|
||||
@@ -57,7 +71,7 @@ class SerieScanner:
|
||||
)
|
||||
self._current_operation_id: Optional[str] = None
|
||||
|
||||
logger.info("Initialized SerieScanner with base path: %s", basePath)
|
||||
logger.info("Initialized SerieScanner with base path: %s", abs_path)
|
||||
|
||||
@property
|
||||
def callback_manager(self) -> CallbackManager:
|
||||
|
||||
Reference in New Issue
Block a user