From 8cc117ec7b127b231bf0ff13112159c814485c6a Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Mon, 27 Jul 2026 18:05:18 +0200 Subject: [PATCH] fix(login): end login flow on terminal poll errors Signed-off-by: Milen Pivchev --- Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift b/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift index 992b2bfe..f3021089 100644 --- a/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift +++ b/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift @@ -113,6 +113,12 @@ final class LoginFlowModel: QRCodeParsing, URLSanitizing { return } + // HTTP 404 means the flow is still pending; any other failure is terminal. + if poll.error != .success, poll.responseData?.response?.statusCode != 404 { + self.endLogin(poll.error) + return + } + try? await Task.sleep(for: .seconds(1)) } }