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

[tools] Fix transforming binary files #19251

Merged
merged 1 commit into from Sep 27, 2022

Conversation

tsapeta
Copy link
Member

@tsapeta tsapeta commented Sep 26, 2022

Why

copyFileWithTransformsAsync in expotools doesn't work properly on binary files. We're reading file contents as utf8-encoded and then writing it as utf8-encoded which may break binary files (e.g. images).

How

When there are no transforms to apply on the file (I assume binary files are not touched by any transform rule), it's safer to copy existing file to the new location rather than writing as utf8-encoded file.

Test Plan

When I tried to upgrade stripe-react-native on both platforms (#19055), I hit the problem on Android that the images were broken after vendoring. This fixed the issue.

@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Sep 26, 2022
@tsapeta tsapeta force-pushed the @tsapeta/tools/fix-transforming-binary-files branch from 1110cef to 5179cc5 Compare September 26, 2022 13:23
@tsapeta tsapeta marked this pull request as ready for review September 26, 2022 14:36
@tsapeta tsapeta requested a review from Kudo September 26, 2022 14:36
tools/src/Transforms.ts Outdated Show resolved Hide resolved
@tsapeta tsapeta force-pushed the @tsapeta/tools/fix-transforming-binary-files branch from 5179cc5 to 8eee411 Compare September 27, 2022 08:52
Copy link
Contributor

@Kudo Kudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat 🔥

@tsapeta tsapeta merged commit f194c86 into main Sep 27, 2022
@tsapeta tsapeta deleted the @tsapeta/tools/fix-transforming-binary-files branch September 27, 2022 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants