microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

The update contents failed the data integrity check (UTF8 characters in filename) #1793

Closed hemith closed 4 years ago

hemith commented 4 years ago

Steps to Reproduce

  1. Add an image file with the file name in Korean. ex) 준비중.png
  2. coding: require('../asset/img/준비중.png') in react-native js code
  3. setup: https://docs.microsoft.com/ko-kr/appcenter/distribution/codepush/react-native#ios-setup
  4. deploying: appcenter codepush release-react -d $deployment -m --description "${desc}"
  5. 1st test: run CodePush.sync() in app. (app is updated)
  6. update some js code
  7. deploying again: appcenter codepush release-react -d $deployment -m --description "${desc}"
  8. 2nd test: run CodePush.sync() in app.
  9. final codePushStatusDidChange status is codePush.SyncStatus.UNKNOWN_ERROR

Expected Behavior

The update contents download and install

Actual Behavior

Update(a zipped file contained main.jsbundle) is downloaded but is not installed. print this log message. https://github.com/microsoft/react-native-code-push/blob/352995d3cfaa9c6c180c7eabe2186dac7a82763d/ios/CodePush/CodePushPackage.m#L295

expectedHash and updateContentsManifestHash is different.

https://github.com/microsoft/react-native-code-push/blob/352995d3cfaa9c6c180c7eabe2186dac7a82763d/ios/CodePush/CodePushUpdateUtils.m#L286

Environment

Additional Information

How I solved..

After I rename file from Korean(UTF8) to English(ASCII). Then Expected hash and actual hash is matched. and codepush is working properly

https://github.com/microsoft/react-native-code-push/blob/352995d3cfaa9c6c180c7eabe2186dac7a82763d/ios/CodePush/CodePushUpdateUtils.m#L91

Question

computeFinalHashFromManifest function return value is incorrect when an image filename(in manifast variable) have UTF8 characters in iOS environment ? Is this a bug?

https://github.com/microsoft/react-native-code-push/blob/352995d3cfaa9c6c180c7eabe2186dac7a82763d/ios/CodePush/CodePushUpdateUtils.m#L79

alexandergoncharov-zz commented 4 years ago

Hi @hemith , Thanks for reporting!

Possibly yes, because I'm not sure that we tested that logic with not the English language. Could you please test this PR and verify if it fixes your issue? https://github.com/microsoft/react-native-code-push/pull/1843 Please let me know your result or if you have any questions.

alexandergoncharov-zz commented 4 years ago

Hi @hemith ,

I'm going to close this issue for now as I haven't heard from you in a while, unfortunately. Please feel free to reopen it if you have any questions.

heeyoonjik commented 2 months ago

@alexandergoncharov-zz @hemith

I was just having the same problem. I removed the image files with Korean names that were stored in src-assets-images, updated the codepush, and accessed the app with an iOS device that was not receiving codepush, and the codepush was applied.

It seems that the file name and codepush are related. https://github.com/lisong/code-push-server/issues/174 this issue opner also mentioned about file name.

DordeDimitrijev commented 2 months ago

Hi @heeyoonjik thank you for reaching out. Could you please share which react-native-code-push version are you using and also react-native version?