Document NFO JavaScript JSON parsing fix

This commit is contained in:
2026-01-18 12:18:58 +01:00
parent c92e2d340e
commit 03901a8c2d

View File

@@ -123,6 +123,28 @@ All tasks completed! Recent issues have been resolved.
## Recently Fixed Issues:
### ✅ Fixed: NFO JavaScript JSON Parsing Error (2026-01-18)
**Issue:** Browser console shows `Error creating NFO: Error: Failed to create NFO` from [nfo-manager.js](../src/server/web/static/js/index/nfo-manager.js) and [series-manager.js](../src/server/web/static/js/index/series-manager.js). The API calls were failing because the code was trying to access response properties directly without parsing the JSON.
**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
---
### ✅ Fixed: NFO 503 Error After Server Reload (2026-01-18)
**Issue:** POST http://127.0.0.1:8000/api/nfo/blue-exorcist/create returns 503 (Service Unavailable) with "NFO service not configured. TMDB API key required." even though TMDB API key is configured in config.json. This occurred after server reloads in development mode (--reload).