fix: prevent duplicate year suffixes in series name and folder creation

Apply the same duplicate-year prevention logic to additional code paths:

- Serie.name_with_year property: skip adding year suffix if name already ends with it
- add_series API endpoint: avoid duplicating year in folder_name_with_year
- Add integration test for Serie.name_with_year idempotency
- Add API test for add_series endpoint year deduplication

Complements the folder_rename_service fix for comprehensive coverage.
This commit is contained in:
2026-05-19 21:25:21 +02:00
parent 75c22fe296
commit 7930e49701
4 changed files with 42 additions and 2 deletions

View File

@@ -730,7 +730,11 @@ async def add_series(
# Create folder name with year if available
if year:
folder_name_with_year = f"{name} ({year})"
year_suffix = f" ({year})"
if name.endswith(year_suffix):
folder_name_with_year = name
else:
folder_name_with_year = f"{name}{year_suffix}"
else:
folder_name_with_year = name