Skip to content

404 on .well-known/matrix/client handled incorrectly. Bad patch included #9056

@shelvacu

Description

@shelvacu

Steps to reproduce

  1. From app first boot with no data
  2. Tap "Sign In"
  3. Tap "Edit" to use a different homeserver
  4. Type consortium.chat (or any homeserver where the .well-known/matrix/client responds with a 404 but is otherwise a normal homeserver)
  5. Tap "Next"

Outcome

What did you expect?

Sign-in continues as normal

What happened instead?

An error is shown: .well-known is not available

Image

Your phone model

Pixel 9 Pro

Operating system version

Android 16

Application version and app store

No response

Homeserver

https://consortium.chat

Will you send logs?

No

Are you willing to provide a PR?

No


I am able to reproduce this in android studio, and this is a fix:

diff --git i/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/wellknown/GetWellknownTask.kt w/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/wellknown/GetWellknownTask.kt
index 003bdab9cb..e1b2f0307e 100644
--- i/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/wellknown/GetWellknownTask.kt
+++ w/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/wellknown/GetWellknownTask.kt
@@ -116,6 +116,12 @@ internal class DefaultGetWellknownTask @Inject constructor(
                         else -> WellknownResult.FailPrompt(null, null)
                     }
                 }
+                is Failure.ServerError -> {
+                    when (throwable.httpCode) {
+                        HttpsURLConnection.HTTP_NOT_FOUND -> WellknownResult.Ignore
+                        else -> WellknownResult.FailPrompt(null, null)
+                    }
+                }
                 is MalformedJsonException, is EOFException -> {
                     WellknownResult.FailPrompt(null, null)
                 }

But I'm sure it's not the correct fix as it duplicates code. I don't know enough kotlin to do this correctly. The issue is that the 404 logic is only implemented for Failure.OtherServerError whereas the exception thrown is a Failure.ServerError.

This also likely fixes #8950 and #8897 even though those are closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-DefectSomething isn't working: bugs, crashes, hangs and other reported problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions