Fix NFO folder naming to include year

- Add Serie.ensure_folder_with_year() method to ensure folder names include year
- Update all NFO API endpoints to call ensure_folder_with_year() before operations
- Folder format is now 'Name (Year)' when year is available
- Add comprehensive tests for ensure_folder_with_year() method
- All 5 tests passing
This commit is contained in:
2026-01-18 12:28:38 +01:00
parent 03901a8c2d
commit 491daa2e50
4 changed files with 148 additions and 8 deletions

View File

@@ -130,15 +130,18 @@ All tasks completed! Recent issues have been resolved.
**Root Cause:** The `AniWorld.ApiClient.request()` function returns a native `Response` object from the Fetch API, not the parsed JSON data. The code was attempting to access properties like `response.message` and `response.content` directly without first calling `response.json()` to parse the response body.
**Solution:** Updated all NFO-related API calls in the JavaScript modules to:
1. Check if response exists (`if (!response)`)
2. Parse the JSON response (`const data = await response.json()`)
3. Access properties on the parsed data object (`data.message`, `data.content`, etc.)
**Files Modified:**
- [src/server/web/static/js/index/nfo-manager.js](../src/server/web/static/js/index/nfo-manager.js) - Fixed `createNFO()`, `refreshNFO()`, `viewNFO()`, `getSeriesWithoutNFO()`
- [src/server/web/static/js/index/nfo-config.js](../src/server/web/static/js/index/nfo-config.js) - Fixed `load()`, `testTMDBConnection()`
**Verification:**
- NFO creation now works correctly from the web UI
- Error messages are properly displayed with details from the API
- All NFO operations (create, refresh, view) function as expected