Skip to content

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

@ma-pe

Description

@ma-pe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact: RegressionDescribes a behavior that used to work on a prior release, but stopped working recently.Resolution: LockedThis issue was locked by the bot.🌐NetworkingRelated to a networking API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions