-
Notifications
You must be signed in to change notification settings - Fork 786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect response.data/response.base64 for Android when using fetch #442
Comments
@oleksandr-dziuban I am also experiencing broken fetch on 0.11.1 version on Android. Could you wrap the fetch from your sample code with try/catch and tell me if you are having following error: RNFetchBlob failed. Download interrupted |
@KrzysztofSakowski In my case i'm just fetching file and use it as base64 string. |
@KrzysztofSakowski just in |
There was a PR that changed string encoding, ill see if I can figure out which PR caused the regression |
@Traviskn Thanks a lot |
#353 changed character encoding, so I suspect it may be the cause. We need to test a branch with this commit reverted to see if the problem goes away. I’ll probably have time later today to test it, but if someone else can test sooner please comment here with your findings |
Just if/else statement deleted here: default data format in response should be base64. If utf-8 requested we need to have utf-8 response
|
Great find! Would you be able to open a PR to add back that if/else statement? |
Not sure if I can compile Java code to check everything. I'm working with JavaScript side only :) |
Ok, I’ll see about adding back the case for base 64 and opening a PR as soon as I can |
Thank you 👍 |
unfortunately this is not going to be quite as simple as just adding back the if/else statement as more of the surrounding workflow was changed by #353, I will likely need to end up reverting it |
I've reverted #353 and published a new version, 0.11.2 |
@Traviskn thanks! I will add this latest version and test |
@Traviskn Everything looks good on Android, Thanks a lot! Closing this issue... |
Hi @Traviskn @oleksandr-dziuban I am using
response data looks broken I am getting a broken response data instead of normal string. |
same issue in version 0.12.0
the request: RNFetchBlob.fetch('GET',url,{
'Content-Type': 'application/octet-stream',
'User-Agent': getUserAgend(),
"Access-Control-Allow-Origin": "*",
})
.then((res) => {
let status = res.info().status;
console.log(92,res);
if(status == 200) {
// the conversion is done in native code
let base64Str = res.base64()
success(base64Str)
} else {
error(JSON.stringify('upload failed!'))
}
})
// Something went wrong:
.catch((errorMessage, statusCode) => {
if (errorMessage) error(JSON.stringify(errorMessage))
}) |
Any update on this? We're also facing the issue on Android |
Hello @Traviskn @mheins57
After the latest 0.11.1 version release I have tried to add this new version to my project and fount possibly regression issue on Android:
When we are using
response.data
looks broken, previuosly it was simple base64 string.response.base64()
throws an errorIn version 0.10.16 everything looks fine. On iOS both versions are working fine.
I'm using react-native@0.61.1
As example i'm fetching this file:
https://api-dev01.elateral-dev.io/file/dev01/S1GbfMFDN
And get broken
response.data
instead of normal base64 string:Could you please check this issue on Android please?
Thank you
The text was updated successfully, but these errors were encountered: