fix: Forgejo updater - structured error handling, ZIP prefix stripping, auth fixes #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/forgejo-updater"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes 3 critical bugs in the Forgejo updater that cause silent failures during updates.
Bug Fixes
Bug 1: Silent HTTP Error Handling
Before:
makeForgejoRequest()returnedfalsefor ALL non-200 responses, losing error details. A 401 auth failure was indistinguishable from a 404 or 500 error.After: Returns structured error info
[success, error, http_code, body]with human-readable messages:Bug 2: ZIP Archive Prefix Not Stripped
Before: Forgejo ZIP archives contain files with a root directory prefix (e.g.,
crashmedia-Arctic_Wolves-abc123/file.php). The updater didn't strip this prefix, causing files to be extracted to the wrong location.After:
downloadAndExtractArchive()detects the common root prefix and strips it before extraction.Bug 3: Auth Headers & Redirect Handling
Before:
makeForgejoRequest()did not follow redirects, causing auth failures on redirect chains.After: Added
CURLOPT_FOLLOWLOCATIONandCURLOPT_MAXREDIRSto all API requests.Additional Improvements
checkForUpdates()andapplyUpdates()now include HTTP status codes and contextTesting