Problem with Amplify.API.get with special characters on Android
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]',
- in iOS it call correctly the URL: https://hostname/users/[email protected]
- in Android it calls the wrong path: https://hostname/users/name.surname%[email protected]
Expected behavior Same behaviour in both the platform.
Platform This issue is reproducible in: [X] Android [] iOS
Possibly related to this amplify-android issue.
Do you have any update here? I'm having the same issue.
This has been resolved and should be available in the next major release.
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.
@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.