Fix - File fetching broken since commit 0c1d2b9#1375
Merged
JakeChampion merged 11 commits intoJakeChampion:masterfrom Aug 28, 2023
Merged
Fix - File fetching broken since commit 0c1d2b9#1375JakeChampion merged 11 commits intoJakeChampion:masterfrom
JakeChampion merged 11 commits intoJakeChampion:masterfrom
Conversation
|
Confirm, RangeError is freaking me out after I've upgraded to expo@49 Code that causes this error: await (await fetch(fileUrl)).blob()) |
Author
@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
JakeChampion
approved these changes
Aug 28, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#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