-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix - File fetching broken since commit 0c1d2b9 #1375
Conversation
Confirm, RangeError is freaking me out after I've upgraded to expo@49
Code that causes this error: await (await fetch(fileUrl)).blob()) |
@bogdanbpeterson A temporary fix is to create your own XMLHttpRequest, just like this library does, except you would handle the errors on your own so that this issue doesn't happen. You can also rollback to the commit of the whatwg/fetch version before the RangeError was introduced. const uriToBlob = (uri: string): Promise<Blob> => {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.onload = () => resolve(xhr.response);
xhr.onerror = () => reject(new Error('uriToBlob failed'));
xhr.responseType = 'blob';
xhr.open('GET', uri, true);
xhr.send(null);
});
}; |
A proposed fix for local file system issues in Android
ddf6866
to
7adfdc7
Compare
#1371
As noted in 1371, and other discussion outside of whatwg/fetch, it's been found that adding the RangeError for statuses outside of 200-599 causes local File fetches to fail.
i.e.
fetch("file://some/local/path")
This PR adds a simple check for the file path before returning the response, it could alternatively be added to the 200/599 status check as a not condition.
Not sure if this has the potential to break other things, or if there's a better way to handle the RangeError issue with
file://
not setting a status.Thanks