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: do not load binary content #1836

Merged
merged 2 commits into from
Sep 1, 2021
Merged

fix: do not load binary content #1836

merged 2 commits into from
Sep 1, 2021

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented Aug 18, 2021

Fixes #1819 by stopping to load the content after we determine it is binary.

I'm not completely sure why it works. I tried playing with the loadContent function to see if anything was wrong, but couldn't find the culprit.

@rafaelramalho19 I'm assigning you to review to make sure that the removal of that line doesn't have any issues. I'm not sure why we need to call loadContent after we determine that it is a binary file.

License: MIT
Signed-off-by: Henrique Dias hacdias@gmail.com

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
@hacdias hacdias temporarily deployed to Deploy August 18, 2021 09:30 Inactive
@hacdias hacdias self-assigned this Aug 18, 2021
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

I suspect loadContent is related to progressive load of big text files added in #1646@rafaelramalho19 may remeber more.

@lidel lidel added the need/analysis Needs further analysis before proceeding label Aug 18, 2021
@hacdias
Copy link
Member Author

hacdias commented Aug 19, 2021

I suspect loadContent is related to progressive load of big text files added in #1646@rafaelramalho19 may remeber more.

Exactly, but such thing is not needed when we detect that we're looking at a binary file. So there's no point on keeping loading it I think. So let's wait for @rafaelramalho19

old one used 7 year old package that had hardcoded check of first 24
bytes, which was not always the best test.

istextorbinary one checks name and 24 bytes at the start, middle,
and end of the buffer – https://github.com/bevry/istextorbinary#readme
@lidel lidel temporarily deployed to Deploy September 1, 2021 23:41 Inactive
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

I did some poking and removal of loadcontent lgtm – most likely a scar tissue from past refactors.

While at it, improved isBinary check in 39b172e – takes filenames into account + should behave better around small binary files (old library hardcoded check that assumed 24 bytes, new one is smarter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/analysis Needs further analysis before proceeding
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

freeze when open a epub file in files tab
2 participants