Skip to content
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

Fetching blobs from filesystem results in blob-size: 0 #19717

Closed
ma-pe opened this issue Jun 14, 2018 · 8 comments
Closed

Fetching blobs from filesystem results in blob-size: 0 #19717

ma-pe opened this issue Jun 14, 2018 · 8 comments
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. 🌐Networking Related to a networking API. Resolution: Locked This issue was locked by the bot.

Comments

@ma-pe
Copy link

ma-pe commented Jun 14, 2018

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.

@react-native-bot react-native-bot added the 🌐Networking Related to a networking API. label Jun 14, 2018
@ma-pe
Copy link
Author

ma-pe commented 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?

@hramos hramos added the Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. label Jun 15, 2018
@gjdycus
Copy link

gjdycus commented Jun 27, 2018

Does anyone know of any workarounds for this?

@satya164
Copy link
Contributor

cc @janicduplessis

@stale
Copy link

stale bot commented 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.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 31, 2018
@satya164 satya164 removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 31, 2018
@reime005
Copy link
Contributor

reime005 commented Nov 1, 2018

This issue is still present in the latest React Native release (0.57.4)

@ma-pe
Copy link
Author

ma-pe commented Nov 5, 2018

This describes the same behaviour: #21092

facebook-github-bot pushed a commit that referenced this issue Dec 11, 2018
…22063)

Summary:
This is a problem that is discussed in issue #21092

Related issues: #21851 #19717

Found the code to eventually fix this issue [here](https://github.com/github/fetch/blob/899b155746630c32d83ee29a38642da16b314ecb/fetch.js#L486)

- [x] Fetching an image locally and check if the blob is there, as well as its size > 0.

___
Help reviewers and the release process by writing your own release notes. See below for an example.

[GENERAL] [ENHANCEMENT] [whatwg-fetch] - set blob as default XMLHttpRequest header response type if supported
Pull Request resolved: #22063

Differential Revision: D13408797

Pulled By: cpojer

fbshipit-source-id: 9822d5a7e24bacd72838f3fc9a61b1a97b44484b
@AndrewSouthpaw
Copy link

It looks like this commit fixes the issue but it hasn't been released to a tagged version, any chance that'll happen soon? 🙏

lnikkila pushed a commit to Boulevard/react-native that referenced this issue Jan 21, 2019
…acebook#22063)

Summary:
This is a problem that is discussed in issue facebook#21092

Related issues: facebook#21851 facebook#19717

Found the code to eventually fix this issue [here](https://github.com/github/fetch/blob/899b155746630c32d83ee29a38642da16b314ecb/fetch.js#L486)

- [x] Fetching an image locally and check if the blob is there, as well as its size > 0.

___
Help reviewers and the release process by writing your own release notes. See below for an example.

[GENERAL] [ENHANCEMENT] [whatwg-fetch] - set blob as default XMLHttpRequest header response type if supported
Pull Request resolved: facebook#22063

Differential Revision: D13408797

Pulled By: cpojer

fbshipit-source-id: 9822d5a7e24bacd72838f3fc9a61b1a97b44484b
@hramos hramos removed the Bug Report label Feb 6, 2019
@Titozzz
Copy link
Collaborator

Titozzz commented 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 😄

@Titozzz Titozzz closed this as completed Mar 19, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. 🌐Networking Related to a networking API. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants