mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Mobile: Avoid crash when downloading large files (#3113)
This commit is contained in:
parent
c593546575
commit
e768b8cfea
@ -83,10 +83,16 @@ function shimInit() {
|
||||
const output = {
|
||||
ok: response.respInfo.status < 400,
|
||||
path: response.data,
|
||||
text: response.text,
|
||||
json: response.json,
|
||||
status: response.respInfo.status,
|
||||
headers: response.respInfo.headers,
|
||||
// If response type is 'path' then calling text() or json() (or base64())
|
||||
// on RNFetchBlob response object will make it read the file on the native thread,
|
||||
// serialize it, and send over the RN bridge.
|
||||
// For larger files this can cause the app to crash.
|
||||
// For these type of responses we're not using the response text anyway
|
||||
// so can override it here to return empty values
|
||||
text: response.type === 'path' ? () => '' : response.text,
|
||||
json: response.type === 'path' ? () => {} : response.json,
|
||||
};
|
||||
|
||||
return output;
|
||||
|
Loading…
Reference in New Issue
Block a user