amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

Problem with Amplify.API.get with special characters on Android

Open thecillu opened this issue 5 years ago • 5 comments

Bug Amplify.API.get call different paths in Android and iOS if the provided path variables contains special chars!

To Reproduce

  Future<User> getUser(String username) async {
    **String path = '/users/$username';**
    print(path);
    RestOptions restOptions = RestOptions(path: path);
    try {
      **RestOperation restOperation = Amplify.API.get(restOptions: restOptions);**
      RestResponse response = await restOperation.response;
      String responseBody = new String.fromCharCodes(response.data);
      var jsonResponse = convert.jsonDecode(responseBody);
      User user;
      if (jsonResponse != null) {
        user = User.fromJson(jsonResponse);
      }
      return user;
    } on ApiException catch (e) {
      print('GET call failed: $e');
    }
  }

If the username variables contains special chars, in call 2 different paths in iOS and Android.

Example: If username equals to '[email protected]',

Expected behavior Same behaviour in both the platform.

Platform This issue is reproducible in: [X] Android [] iOS

thecillu avatar Mar 16 '21 10:03 thecillu

Possibly related to this amplify-android issue.

haverchuck avatar Mar 23 '21 19:03 haverchuck

Do you have any update here? I'm having the same issue.

Arkania9 avatar Oct 26 '21 08:10 Arkania9

This has been resolved and should be available in the next major release.

Jordan-Nelson avatar Apr 26 '22 21:04 Jordan-Nelson

Hello - Apologies for the delay on this.

There was a fix in Amplify-Android that I believe will resolve this. We had upgraded the version of Amplify-Android used in Amplify-Flutter to a version that would include this fix, but due to a bug we had downgrade it for the latest release.

The latest stable version of Amplify-Flutter (0.5.0) depend on Amplify-Android 1.33.0. The fix is in version 1.35.1. I am going to remove the pending-release tag until we pull back in 1.35.1 or higher.

Jordan-Nelson avatar May 18 '22 19:05 Jordan-Nelson

@thecillu - The fix should have been included in v0.6.2 of Amplify-Flutter. If you are experiencing this issue with a recent version of Amplify-Flutter, please let us know.

Jordan-Nelson avatar Nov 18 '22 20:11 Jordan-Nelson