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

fix: fix new File by only fileName #2149

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

LittleXianyu
Copy link
Contributor

No description provided.

@LittleXianyu
Copy link
Contributor Author

fix #2148

@ball-hayden
Copy link

ball-hayden commented Oct 5, 2021

Resolves #2138
Resolves #2136
Probably resolves #2095

To provide a bit more information on why this change is necessary:
https://github.com/microsoft/react-native-code-push/pull/2132/files changed the return value of FileUtils. validateFileName to also include the absolute path to the file, while previously it was a relative path.

The directory is then concatenated again to the file name when it is unzipped:

String fileName = validateFileName(entry.getName(), destinationFolder);
File file = new File(destinationFolder, fileName);

This doesn't affect JS bundles, as CodePush searches for a bundle as deep as it needs to (findJSBundleInUpdateContents).
For a diff update,

String diffManifestFilePath = CodePushUtils.appendPathComponent(unzippedFolderPath,
CodePushConstants.DIFF_MANIFEST_FILE_NAME);
boolean isDiffUpdate = FileUtils.fileAtPathExists(diffManifestFilePath);
incorrectly returns false as the diff manifest file is actually nested much deeper than we expected. This results in anything other than the jsbundle being "lost".

@ball-hayden
Copy link

@andreidubov (as the introducer of the bug) or @alexandergoncharov (as an approver) - please could you review this fix?
CodePush for Android really is quite broken at the moment, because of #2132.

@alexandergoncharov-zz
Copy link
Contributor

@LittleXianyu Thanks for contributing!

@ball-hayden Thanks for describing this PR!

You guys are awesome :)

@evelant
Copy link

evelant commented Oct 26, 2021

@alexandergoncharov This apparently didn't fix the issue. Still seeing it on 7.0.4. Images disappear on android after a 2nd push is applied.

sourabhdebnath pushed a commit to scripbox/react-native-code-push that referenced this pull request May 2, 2022
Co-authored-by: liuyunpeng <liuyunpeng@innotechx.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants