Fix NFO creation 500 error for missing folders

- Auto-create series folder if it doesn't exist
- Add unit and integration tests for folder creation
- NFO creation now works for newly added series
This commit is contained in:
2026-01-18 12:07:37 +01:00
parent 9877f9400c
commit 4e56093ff9
4 changed files with 261 additions and 2 deletions

View File

@@ -119,10 +119,32 @@ For each task completed:
## TODO List:
All tasks completed! The NFO database query issue has been resolved.
All tasks completed! Recent issues have been resolved.
## Recently Fixed Issues:
### ✅ Fixed: NFO Creation 500 Error - Missing Folder (2026-01-18)
**Issue:** POST http://127.0.0.1:8000/api/nfo/blue-period/create returns 500 (Internal Server Error) with message "Series folder not found: /home/lukas/Volume/serien/Blue Period"
**Root Cause:** The NFO service was checking if the series folder existed before creating NFO files, and raising a FileNotFoundError if it didn't. This prevented users from creating NFO files for newly added series where no episodes had been downloaded yet.
**Solution:** Modified `create_tvshow_nfo()` in `nfo_service.py` to automatically create the series folder (with `mkdir(parents=True, exist_ok=True)`) if it doesn't exist, instead of raising an error.
**Files Modified:**
- [src/core/services/nfo_service.py](../src/core/services/nfo_service.py)
**Tests Added:**
- [tests/unit/test_nfo_service_folder_creation.py](../tests/unit/test_nfo_service_folder_creation.py) - Unit test verifying folder creation
- [tests/integration/test_nfo_folder_creation.py](../tests/integration/test_nfo_folder_creation.py) - Integration test for end-to-end verification
**Verification:**
- Unit and integration tests pass
- NFO files can now be created for series even when the folder doesn't exist
- Folder is automatically created when needed
---
### ✅ Fixed: NFO Service 503 Error (2026-01-18)
**Issue:** Failed to load resource: the server responded with a status of 503 (Service Unavailable) when creating NFO files.
@@ -132,6 +154,7 @@ All tasks completed! The NFO database query issue has been resolved.
**Solution:** Updated `fastapi_app.py` startup code to sync NFO configuration (including TMDB API key) from `data/config.json` to `settings` object, similar to how `anime_directory` was already being synced.
**Files Modified:**
- [src/server/fastapi_app.py](../src/server/fastapi_app.py)
**Verification:** NFO endpoints now return 200 OK instead of 503, and NFO creation is functional.