mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
fix: address additional CodeRabbit review comments
- Make rclone cleanup() idempotent by always resetting state and clearing RCLONE_CONFIG env var - Sanitize artist/title in lyrics_worker to prevent path injection when constructing correction filenames Bump version to 0.71.15
This commit is contained in:
3 files changed
+12
-5
No files matched your search
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
+1
-1
@@ -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 <andrew@beveridge.uk>"]
|
||||
license = "MIT"
|
||||
|
||||
Reference in new issue
Block a user