From 075b6cf69cf4eee17bab7a30bc4bbd41263bc042 Mon Sep 17 00:00:00 2001 From: heaven Date: Sat, 9 May 2026 15:07:35 +0300 Subject: [PATCH] fix(android): redirect to root on logout to dodge Capacitor SPA-fallback failure on URL-encoded path segments --- src/client/initMatrix.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/initMatrix.ts b/src/client/initMatrix.ts index 030160a6..912fb7dd 100644 --- a/src/client/initMatrix.ts +++ b/src/client/initMatrix.ts @@ -102,7 +102,13 @@ export const logoutClient = async (mx: MatrixClient) => { } await mx.clearStores(); window.localStorage.clear(); - window.location.reload(); + // Navigate to root instead of reload(): on Android Capacitor the + // WebViewLocalServer fails to SPA-fallback on URLs with `%3A` in path + // segments (Matrix room/space ids), so reload of `///` + // or `/channels//...` returns ERR_HTTP_RESPONSE_CODE_FAILURE. + // Replacing to `/` always resolves to index.html; the Router index + // loader then redirects to the login page since the session is gone. + window.location.replace('/'); }; export const clearLoginData = async () => {