From 4bee82dbe0813e3cd0d235cec8d20b15c5710729 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 30 Aug 2021 08:27:18 +0200 Subject: [PATCH] fix: uiaRequests send broken auth object at first try We should just let the `auth` object null and dont send it at the first try and wait for the servers response. This worked in the past but now it is broken because of changes in the matrix_api_lite. This could also be fault for some bootstrap issues. I have also removed an unnecessary check if a String is a String and just made it a null check because this was intended at this point. Because of that this blocks uiaRequests it is a hotfix and therefore directly bumps the version. --- CHANGELOG.md | 3 +++ lib/src/utils/uia_request.dart | 4 +--- pubspec.yaml | 2 +- test/uia_test.dart | 8 +++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a26713a7..85e71136 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [0.3.6] - 30nd Aug 2021 +- hotfix: uiaRequests send broken auth object at first try + ## [0.3.5] - 28nd Aug 2021 - hotfix: Send unencrypted thumbnails diff --git a/lib/src/utils/uia_request.dart b/lib/src/utils/uia_request.dart index ed8f66e8..575b56e0 100644 --- a/lib/src/utils/uia_request.dart +++ b/lib/src/utils/uia_request.dart @@ -59,14 +59,12 @@ class UiaRequest { Future _run([AuthenticationData auth]) async { state = UiaRequestState.loading; try { - auth ??= - AuthenticationData(session: session, type: AuthenticationTypes.token); final res = await request(auth); state = UiaRequestState.done; result = res; return res; } on MatrixException catch (err) { - if (!(err.session is String)) { + if (err.session == null) { rethrow; } session ??= err.session; diff --git a/pubspec.yaml b/pubspec.yaml index 02f2a6e2..b8ada0e0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: matrix description: Matrix Dart SDK -version: 0.3.5 +version: 0.3.6 homepage: https://famedly.com environment: diff --git a/test/uia_test.dart b/test/uia_test.dart index aa262890..3d01e6b0 100644 --- a/test/uia_test.dart +++ b/test/uia_test.dart @@ -32,14 +32,16 @@ void main() { var finished = false; final request = UiaRequest( request: (auth) async { - if (auth.session != null && auth.session != 'foxies') { + if (auth != null && + auth.session != null && + auth.session != 'foxies') { throw MatrixException.fromJson({}); } - if (auth.type == 'stage1') { + if (auth != null && auth.type == 'stage1') { if (completed.isEmpty) { completed.add('stage1'); } - } else if (auth.type == 'stage2') { + } else if (auth != null && auth.type == 'stage2') { if (completed.length == 1 && completed[0] == 'stage1') { // okay, we are done! return 'FOXIES ARE FLOOOOOFY!!!!!';