Repository navigation
Fetching blobs from filesystem results in blob-size: 0 #19717
Description
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.4
CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 769.02 MB / 16.00 GB
Shell: 2.7.1 - /usr/local/bin/fish
Binaries:
Node: 8.9.3 - ~/.nvm/versions/node/v8.9.3/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.1.0 - ~/.nvm/versions/node/v8.9.3/bin/npm
Watchman: 4.9.1 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 9.4/9F1027a - /usr/bin/xcodebuild
npmPackages:
react: 16.4.1 => 16.4.1
react-native: 0.56.0-rc => 0.56.0-rc
Description
After upgrading from react native 0.55.4 (which introduced blob fetching) to react native 0.56.0-rc I experience issues with blob fetching on iOS (android not tested). When fetching an image/video from filesystem and building a blob from it, the blob-size is 0.
const mediaResponse = await fetch('file:///var/mobile/Containers/Data/Application/.../Library/CachesCamera/....mov');
// convert response to blob
const mediaBlob = await mediaResponse.blob();
console.log(mediaBlob.size)
// 0
I am aware of this react-native-blob-test repo but these tests doesn't seem to fail on size === 0 since an && operator is used instead of an || operator : https://github.com/expo/react-native-blob-test/blob/c0dbd66f4e2a193a5031c52c9b49ea2a6b4419ed/index.common.js#L291
Steps to Reproduce
https://github.com/expo/react-native-blob-test/blob/master/index.common.js#L134
Expected Behavior
Since the image/video exists (i can save it via CameraRoll.saveToCameraRoll) the resulting blob should have a valid size (positive number).
Actual Behavior
The blob has a size of 0.
Activity
ma-pe commentedon Jun 15, 2018
initial blob fetch support was added with the commits be56a3e and 854c233 by @satya164 and @fkgozali.
Possible impacting commits in the last release were 122b3791ede095345f44666691aa9ce5aa7f725a and 093a78d by @janicduplessis and @grabbou.
Any ideas on this?
gjdycus commentedon Jun 27, 2018
Does anyone know of any workarounds for this?
satya164 commentedon Jun 27, 2018
cc @janicduplessis
stale commentedon Oct 31, 2018
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.
reime005 commentedon Nov 1, 2018
This issue is still present in the latest React Native release (0.57.4)
ma-pe commentedon Nov 5, 2018
This describes the same behaviour: #21092
set blob as default XMLHttpRequest header response type if supported (#…
AndrewSouthpaw commentedon Jan 3, 2019
It looks like this commit fixes the issue but it hasn't been released to a tagged version, any chance that'll happen soon? 🙏
set blob as default XMLHttpRequest header response type if supported (r…
Titozzz commentedon Mar 19, 2019
This commit has been released as part of 0.59 so I'll close the issue.
Please let us know if anything is still not working!
Thanks everyone 😄