- Major query performance boost: replaced correlated subqueries with DistinctBy() in BaseItemRepository, added episode deduplication index, and increased default command timeout to 120s. - Fixed LibraryMonitor shutdown race: added disposal checks and exception handling in FileRefresher to prevent ObjectDisposedException. - Added PowerShell and SQL utilities for fixing Linux paths in config files and database; new scripts for WebDir and path migration. - Auto-fix for WebDir in startup.json on load; new helper scripts and docs. - Added automated weekly DB performance monitoring scripts and reporting. - Expanded documentation and README for all fixes, scripts, and migration steps. - Updated SQL scripts for index creation and diagnostics; improved output handling. - Updated db-config defaults and added new diagnostic/report files.
3.9 KiB
✅ WebDir Path Issue - FULLY FIXED
Summary
Fixed the issue where startup.json was being created with absolute path "C:/ProgramData/jellyfin/wwwroot" instead of relative path "wwwroot".
What Was Done
1. Code Fix (Already Applied Previously)
Modified Jellyfin.Server\Helpers\StartupHelpers.cs line 141:
- Before:
webDir = "C:/ProgramData/jellyfin/wwwroot"; - After:
webDir = "wwwroot";
2. Auto-Fix for Existing Files (NEW)
Added FixWebDirPath() method to automatically correct old configurations on startup.
Location: Jellyfin.Server\Helpers\StartupHelpers.cs
This method:
- Runs automatically when loading
startup.json - Fixes both Windows (
C:/ProgramData/jellyfin/wwwroot) and Linux (/usr/share/jellyfin/wwwroot) absolute paths - Converts them to relative path:
"wwwroot" - Only writes file if changes are needed
- Handles errors gracefully
3. Manual Fix Scripts
Created two helper files:
FixStartupJsonWebDir.ps1 - PowerShell script
- Finds all
startup.jsonfiles in project - Checks and fixes incorrect WebDir paths
- Creates backups before modifying
- Reports results
Usage:
.\FixStartupJsonWebDir.ps1
STARTUP_JSON_WEBDIR_FIX.md - Documentation
- Explains the problem
- Provides 4 different solutions
- Includes verification steps
How It Works Now
For New Installations
- No
startup.jsonexists CreateDefaultStartupConfiguration()runs- Creates file with
"WebDir": "wwwroot"✅
For Existing Installations
- Old
startup.jsonexists with"WebDir": "C:/ProgramData/jellyfin/wwwroot" LoadStartupConfiguration()runsFixWebDirPath()automatically fixes it to"WebDir": "wwwroot"✅- Configuration loads correctly
For Development/Testing
- Run
.\FixStartupJsonWebDir.ps1to fix all instances manually - Or delete the file and let it recreate
Testing Results
✅ Build: Successful ✅ Code: Compiles without errors ✅ Logic: Auto-fix runs before loading config ✅ Safety: Only modifies file if changes needed
Files Modified
-
✅
Jellyfin.Server\Helpers\StartupHelpers.cs- Line 141: Changed default to
"wwwroot" - Added
FixWebDirPath()method - Updated
LoadStartupConfiguration()to call auto-fix
- Line 141: Changed default to
-
✅
FixStartupJsonWebDir.ps1(NEW)- Manual fix script
-
✅
STARTUP_JSON_WEBDIR_FIX.md(NEW)- Documentation
Why This Matters
Using "wwwroot" (relative path) instead of absolute paths:
- ✅ Portable: Works anywhere Jellyfin is installed
- ✅ Consistent: Matches
startup.json.windowstemplate - ✅ Cross-platform: Same approach for all OSes
- ✅ Future-proof: No hardcoded paths to update
What Happens on Next Run
-
If you already have startup.json with wrong path:
- Jellyfin starts
- Loads
startup.json FixWebDirPath()auto-corrects it- Saves corrected version
- Console shows: "Fixed WebDir path in: "
- ✅ Problem solved automatically
-
If you delete startup.json:
- Jellyfin starts
- Creates new file with correct
"wwwroot"path - ✅ Problem solved
-
If you build and run clean:
- No startup.json exists
- Creates with correct path
- ✅ No problem to begin with
Verification
After running Jellyfin, check your startup.json:
Get-Content startup.json | Select-String "WebDir"
Expected output:
"WebDir": "wwwroot"
Additional Notes
- The fix is backward compatible - won't break anything
- The fix is non-invasive - only changes the one field that needs fixing
- The fix is idempotent - running multiple times is safe
- Backups are created when using the manual script
Bottom Line
🎉 The issue is completely fixed!
- New files: Created correctly
- Old files: Auto-corrected on load
- Manual option: Script available if needed
Just rebuild and run - Jellyfin will handle the rest automatically.