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.
Proposed changes
If an image cannot be viewed, an error message is shown but nothing of the file itself.
The user has has therefore no possibility to find the core problem.
If the file cannot be shown , this could be due to that the information the user has put in Git is corrupt, that the GE implementation cannot handle this type of image (like the GE hardcoded extension is used for another file) or that the image is stored with LFS. For LFS, GE (and most tools and web interfaces, but shown in GitHub) does not fetch the actual file but tries to display the LFS text as an image which obviously will fail. #6189 is WIP and has been that for some time....
Both GE not handling images and LFS will likely affect all "images" in a certain repo and most users will not understand why.
This PR will therefore display a hexdump with the information. For LFS files, you can read the test and hopefully understand that this is really a LFS file, not corrupt.
Screenshots
Before
After
Test methodology
View images in LFS enabled repo, also with corrupted images.
The repo with the screenshots: https://github.com/gerhardol/tmp_test/tree/test/unicode
✒️ I contribute this code under The Developer Certificate of Origin.