Do not attempt string replacements on binary files #1405
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
If you attempt to do string replacements on a binary file (e.g. an image) it will become corrupt due to the
.toString()
conversion. This change prevents string replacements from running on binary files.@W-16560716@
Testing
staticresource
imageretrieve
it to your local projectsfdx-project.json
export FOO="bar"
or it will complain that the env is not setsf project deploy start --source-dir force-app/main/default/staticresources
changed
staticresource
in the browser and you will notice that the size is much larger and it will also fail to render if you clickView file
retrieve
again or your local image will become corruptyarn link
it inplugin-deploy-retrieve
, andsf plugins link .
PDRsf project deploy start --source-dir force-app/main/default/staticresources
changed
again, but this is because it is replacing the corrupt versionsf project deploy start --source-dir force-app/main/default/staticresources
on final time and it should show asunchanged
Notes
Here are some screenshots showing the file size differences. There values are used in the NUTs to confirm the file did not change.
OK:
Corrupt:
Proof from test: