react / react/react-native

[iOS] Uploading an image will change the file size of the image

未关闭
#45,962 22 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Component: Image Issue: Author Provided Repro Needs: Repro Platform: iOS
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

I uploaded a 2M image and the server received a 6M image. After debugging, the form data sent by the RCTNetworking became larger.

Steps to reproduce
  1. Clone the reproducer from https://github.com/carverhong/react-native-reproducer-ios-image-upload.git.

  2. Install dependency and prepare the ios project.

cd react-native-reproducer-ios-image-upload
npm install
bundle install
cd ios
bundle exec pod install

After the installation is complete, the RCTNetworking log patch is automatically added for debugging.

企业微信截图_42a75d24-fd86-4f7a-873f-933102ef4bcc
  1. Start Metro.
npm start
  1. Open HelloWorld.xcworkspace with XCode and run the APP.
  2. Use the RCTNetworking keyword to filter logs.
企业微信截图_33a594cf-1b54-42c5-ab8f-69b3b4484d01
React Native Version

0.72.15

Affected Platforms

Runtime - iOS

Output of npx react-native info
System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M3
  Memory: 87.55 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: ~/tools/nodejs/node-v18.19.0-darwin-arm64/bin/node
  Yarn: Not Found
  npm:
    version: 10.2.3
    path: ~/tools/nodejs/node-v18.19.0-darwin-arm64/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.15
    wanted: 0.72.15
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
Stacktrace or Logs
[RCTNetworking processDataForHTTPQuery] file:///Users/carverhong/Library/Developer/CoreSimulator/Devices/E094052D-91B7-493F-A39A-72F089B8937D/data/Containers/Bundle/Application/8BFC2E5C-87BD-4295-A8F0-F04272BC374A/HelloWorld.app/20240808144728-0.jpg rawDataSize=2017293
[RCTNetworking handleResult] multipartDataSize=6151776
Reproducer

https://github.com/carverhong/react-native-reproducer-ios-image-upload.git

Screenshots and Videos

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从提供的 reproducer 及其 RCTNetworking 日志开始,然后跟踪 processDataForHTTPQuery 和 handleResult 路径。比较 iOS 上传期间的 rawDataSize 与 multipartDataSize,并确定扩展发生的位置。当 server 收到上传的图像且没有报告中的大小增加,并且该情况具有回归测试覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, react-native
领域
mobile, networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。