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 #179 Detect pdf's as binary not text. #234

Merged
merged 1 commit into from
Jun 17, 2019

Conversation

wvspee-eyeo
Copy link
Contributor

Changed the detection in DirectoryReader.is_binary to only return False if the file has a text/ mime type, otherwise or if the mime type couldn't be detected assume binary.

@joeyespo
Copy link
Owner

Hey @wvspee, I like the idea! There's one edge case this isn't handling though, which is when mimetypes.guess_type(subpath) fails to resolve Markdown files. (And this can be simplified, as suggested by @dmadisetti.)

I'll go ahead and merge this and clean it up before releasing. Thanks for taking the time to open this 😃

@joeyespo joeyespo merged commit 21ecb67 into joeyespo:master Jun 17, 2019
@joeyespo joeyespo added the bug label Jun 17, 2019
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Apr 30, 2024
- Fix "ImportError: cannot import name 'safe_join' from 'flask'" when using Flask 2.1.0+ ([#360](joeyespo/grip#360) - thanks, [@bryce-carson][]!)

- Update output and **fix style issues**
- Add support for **Python 3.7, 3.8, 3.9, 3.10**
- Improve handling of PDFs and other binary files
- Fix deprecation warnings from newer dependency versions

- End-of-life [Python versions](https://devguide.python.org/#status-of-python-branches) no longer intentionally supported
  - Python 2.6, 2.7 (Python 2 compatibility will be removed entirely in the next major release)
  - Python 3.0, 3.1, 3.2, 3.3 ([#275](joeyespo/grip#275) - thanks, [@svisser][]!), 3.4, 3.5, 3.6
- Current [dependency versions](requirements.txt) (more recent versions will be required in the next major release)

- Fix typo in error message ([#266](joeyespo/grip#266) - thanks, [@Godron629][]!)
- Update HTML/CSS scaffold to match GitHub ([#297](joeyespo/grip#297) - thanks, [@phyllisstein][]!)
- Fix tests by adding a missing `USER_CONTEXT` argument to one of the `GitHubRenderer` calls
- Serve non-`text/` MIME types as raw files for better handling of, e.g. PDF files ([#234](joeyespo/grip#234) - thanks, [@wvspee][]!)
- Fix style parsing, which caused some styles to be missing ([#347](joeyespo/grip#347))

- Readme: Update to correct `--no-inline` option ([#267](joeyespo/grip#267) - thanks, [@TomDLT][]!)
- Readme: Fix links to Grip class ([#276](joeyespo/grip#276) - thanks, [@jacebrowning][]!)
- Readme: Clarify that this sends your markdown to GitHub ([#251](joeyespo/grip#251) - thanks, [@courajs][]!)
- Update `pytest` usages (see [pytest 3.0.0 changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst#300-2016-08-18))
- Add `.pytest_cache` to `.gitignore` ([#287](joeyespo/grip#287) - thanks, [@svisser][]!)
- Add `.venv` and `.idea` to `.gitignore` and clean up
- Add `flake8` test dependency and fix linting errors ([#299](joeyespo/grip#299))
- Add `pytest` test dependency ([#294](joeyespo/grip#294) - thanks, [@Methacrylon][]!)
- License: Distribute LICENSE file ([#274](joeyespo/grip#274) - thanks, [@synapticarbors][]!)
- License: Update year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants