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

Git diff of too large image file: Unsupported text encoding and NaNTB #50103

Closed
benurb opened this issue May 18, 2018 · 12 comments
Closed

Git diff of too large image file: Unsupported text encoding and NaNTB #50103

benurb opened this issue May 18, 2018 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) help wanted Issues identified as good community contribution opportunities workbench-editors Managing of editor widgets in workbench window
Milestone

Comments

@benurb
Copy link

benurb commented May 18, 2018

  • VSCode Version: 1.23.1
  • OS Version: mac OS 10.13.4 High Sierra

Steps to Reproduce:

  1. Create git repo
  2. Create an image file that is larger than the limit for the built-in image preview and commit it to the repo
  3. Replace it with a smaller image and look at the diff from the source control view
  4. It shows "The file is not displayed in the editor because it is either binary or uses an unsupported text encoding." instead of the preview of the large image. Furthermore it shows NaNTB as file size of the previous image in the status bar.

image

Does this issue occur when all extensions are disabled?: Yes

@vscodebot vscodebot bot added the git GIT issues label May 18, 2018
@joaomoreno joaomoreno added the workbench-editors Managing of editor widgets in workbench window label May 28, 2018
@joaomoreno joaomoreno added this to the Backlog milestone May 28, 2018
@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label May 28, 2018
@bpasero
Copy link
Member

bpasero commented May 28, 2018

/cc @mjbvz for the status bar bug

@bpasero bpasero removed this from the Backlog milestone May 28, 2018
@bpasero
Copy link
Member

bpasero commented May 28, 2018

Actually, giving it to you @mjbvz because it seems to me that also the left-hand binary view should read this instead: The file is not displayed in the editor because it is too large

@joaomoreno joaomoreno removed the git GIT issues label Sep 19, 2018
@bpasero
Copy link
Member

bpasero commented Oct 4, 2018

I pushed a fix to not draw NanTB in the status bar if the size is not known.

bpasero added a commit that referenced this issue Oct 4, 2018
@mjbvz mjbvz added the help wanted Issues identified as good community contribution opportunities label Dec 15, 2018
@mjbvz mjbvz added this to the October 2019 milestone Oct 10, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Oct 24, 2019

I've confirmed that we no longer show the NaN TB in the status bar.

We still do not show anything helpful on the left side of the editor for large image however. This root cause is that for the left side resource, VS Code uses a uri such as "data:%3Blabel%3Abig.png%3Bdescription%3AHEAD%2C". I believe that these uris are created here by the git extension:

if (size > 1000000) { // 1 MB

@joaomoreno Do you have ideas on if or how we could handle this case better? Should we use the label in the data uri to try to detect that the file is an image?

@joaomoreno
Copy link
Member

joaomoreno commented Oct 24, 2019

Would this be solved by using an FS provider for git resources and moving away from the TextDocumentContentProvider?

cc @bpasero

@joaomoreno
Copy link
Member

joaomoreno commented Oct 24, 2019

Since the 1MB is a well known limitation of the current approach, I'm removing myself from this October issue. FS Provider might be a solution, but definitely not for October.

@joaomoreno joaomoreno removed their assignment Oct 24, 2019
@bpasero
Copy link
Member

bpasero commented Oct 24, 2019

@joaomoreno my understanding is that this data is flowing around via data-URIs, no?

I think, yes, a file system provider for Git is ideal for all cases 👍

@joaomoreno
Copy link
Member

joaomoreno commented Oct 24, 2019

Yes, but that's because Git still uses the once-upon-a-time-was-the-only-thing-available TextDocumentContentProvider... if we were to switch to the FS Provider, couldn't we send binary files as well?

@bpasero
Copy link
Member

bpasero commented Oct 24, 2019

@mjbvz should comment on that, since he rewrote the binary viewer as extension, I am not sure how binary data is shown.

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 24, 2019

@joaomoreno Yes, if git returned a uri that points to a custom file system provider, it could provide binary data as well

@joaomoreno
Copy link
Member

#55110

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 25, 2019

Ok, thanks. Closing this as a duplicate of #55110 then

@mjbvz mjbvz closed this as completed Oct 25, 2019
@mjbvz mjbvz added the *duplicate Issue identified as a duplicate of another issue(s) label Oct 25, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) help wanted Issues identified as good community contribution opportunities workbench-editors Managing of editor widgets in workbench window
Projects
None yet
Development

No branches or pull requests

4 participants