fix: sanitize_output_stem signature + audio_sink import

Two pre-existing bugs found during test coverage analysis:

1. sanitize_output_stem() only accepted 1 arg but resolve_project_layout
   passed 2 args (name, index) via sanitize_fn parameter.
   Fix: added optional index parameter to sanitize_output_stem.

2. audio_sink.py imported get_internal_cache_path from
   abogen.infrastructure.cache which doesn't exist.
   Fix: import from abogen.utils where the function lives.
This commit is contained in:
Artem Akymenko
2026-07-21 09:18:51 +00:00
parent 7973de3868
commit 4c4434c309
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ def _ensure_ffmpeg() -> None:
def _get_ffmpeg_cache_root() -> str:
from abogen.infrastructure.cache import get_internal_cache_path
from abogen.utils import get_internal_cache_path
return get_internal_cache_path("ffmpeg")
+1 -1
View File
@@ -76,7 +76,7 @@ def sanitize_filename_for_chapter(title: str, index: int, max_len: int = 80) ->
return f"{index:02d}_{sanitized}"
def sanitize_output_stem(name: str) -> str:
def sanitize_output_stem(name: str, index: int = 0) -> str:
base = Path(name or "").stem
sanitized = _OUTPUT_SANITIZE_RE.sub("_", base).strip("_")
return sanitized or "output"