diff --git a/backend/services/rclone_service.py b/backend/services/rclone_service.py index 4ef328b2..72682123 100644 --- a/backend/services/rclone_service.py +++ b/backend/services/rclone_service.py @@ -81,9 +81,12 @@ class RcloneService: logger.debug(f"Cleaned up rclone config file: {self._config_file}") except Exception as e: logger.warning(f"Failed to cleanup rclone config: {e}") - finally: - self._config_file = None - self._config_loaded = False + + # Always reset internal state and environment, even if the file was missing + if self._config_file is not None: + os.environ.pop("RCLONE_CONFIG", None) + self._config_file = None + self._config_loaded = False @property def is_configured(self) -> bool: diff --git a/backend/workers/lyrics_worker.py b/backend/workers/lyrics_worker.py index 70bdbde6..acd8816a 100644 --- a/backend/workers/lyrics_worker.py +++ b/backend/workers/lyrics_worker.py @@ -23,6 +23,7 @@ from typing import Optional, Dict, Any from pathlib import Path from backend.models.job import JobStatus +from karaoke_gen.utils import sanitize_filename from backend.services.job_manager import JobManager from backend.services.storage_service import StorageService from backend.workers.worker_logging import create_job_logger, setup_job_logging @@ -391,7 +392,10 @@ async def upload_lyrics_results( # Upload corrections JSON (for review interface) # LyricsProcessor saves it as "{artist} - {title} (Lyrics Corrections).json" - corrections_filename = f"{job.artist} - {job.title} (Lyrics Corrections).json" + # Sanitize artist/title to prevent path injection and match LyricsProcessor's sanitization + safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown" + safe_title = sanitize_filename(job.title) if job.title else "Unknown" + corrections_filename = f"{safe_artist} - {safe_title} (Lyrics Corrections).json" corrections_file = os.path.join(lyrics_dir, corrections_filename) # Also check for generic corrections.json (fallback) diff --git a/pyproject.toml b/pyproject.toml index c7fe70a9..91452fc4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "karaoke-gen" -version = "0.71.14" +version = "0.71.15" description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens." authors = ["Andrew Beveridge "] license = "MIT"