mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-07-27 00:39:26 +00:00
* Fix HTTP handler to accept ACI/UUID account parameter in SSE endpoint MultiAccountManagerImpl.getManager() only looked up accounts by phone number, causing HTTP 400 errors when the SSE events endpoint was called with ?account=<ACI-UUID> (e.g., cc528f93-527e-4566-8c62-d12dc99dbce0). Changes: - SignalAccountFiles: Add initManagerByAci() method for ACI-based lookup - MultiAccountManagerImpl: getManager() now tries ACI lookup when phone number lookup fails - HttpServerHandler: getManagerFromQuery() falls back to returning all managers when the specific account identifier is not found (instead of HTTP 400) * Fix SSE endpoint for UUID account parameter & preserve '+' in phone numbers Three interrelated fixes for the HTTP SSE endpoint: 1. **SignalAccountFiles** — Replace ACI.parseOrThrow() with UUID-string lookup from accountsStore.getAllAccounts(). The old approach failed when a raw UUID string (from URL query param) was passed. Added getAccountNumberByAci() helper to reduce duplication. 2. **MultiAccountManagerImpl** — Catch IllegalArgumentException in getManager() for both phone number and ACI lookup paths. Also check if the UUID corresponds to an already-loaded manager before trying to initByAci(), preventing OverlappingFileLockException when SSE requests arrive with a UUID for an account that was loaded at startup. 3. **Util.getQueryMap()** — Preserve '+' characters in query parameter values by escaping them before URLDecoder.decode(). Without this, URLDecoder converts '+' to space, breaking phone numbers like '+4915422389' which become ' 4915422389'. * fix: address AsamK's review comments - HttpServerHandler.getManagerFromQuery(): return null when account not found instead of falling back to all managers (AsamK: 'should stay return null here') - MultiAccountManagerImpl.getManager(): use UuidUtil.isUuid() to branch early on ACI vs phone number, eliminating the try-number-then-fallback pattern (AsamK: 'check if identifier is a uuid first') --------- Co-authored-by: Till L T <tilllt@users.noreply.github.com>