fix: detect upstream API errors in stream endpoint to prevent null URL responses

- Added upstream error detection in streamInfo.extractor.js (status >= 400)
- Added non-JSON error string detection from upstream API
- Updated streamInfo.controller.js to return HTTP 502 for upstream failures
- Fixes /api/stream returning null URL when upstream returns error responses
This commit is contained in:
Shinei Nouzen
2026-08-14 06:36:37 +05:30
parent 107e3c71e7
commit 320bf0915b
3 changed files with 39 additions and 2 deletions
+10
View File
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.2.2] - 2026-08-14
### Fixed
- **CRITICAL**: Fixed `/api/stream` returning `null` URL when upstream API returns error responses (e.g. `{status: 500, result: "Bad request"}`) — extractor now detects upstream error status codes and throws meaningful errors instead of silently returning null
- Fixed `streamInfo.extractor.js` `extractStreamInfo` to detect upstream API error responses (`data.status >= 400`) and throw descriptive errors
- Fixed `streamInfo.extractor.js` `extractStreamInfo` to detect non-JSON error strings from upstream API (e.g. "Bad request") and throw errors instead of silently swallowing them
- Fixed `streamInfo.extractor.js` `extractServerList` to detect upstream API error responses and throw descriptive errors
- Fixed `streamInfo.controller.js` `getStreamInfo` to return HTTP 502 (Bad Gateway) with error message for upstream API failures instead of silently returning null URL
- Fixed `streamInfo.controller.js` `getServerList` to properly propagate upstream errors via error handler
## [2.2.1] - 2026-08-12
### Fixed