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

Revert "Fix for when 'trailer' is indented" #534

Merged
merged 1 commit into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Rename PDFTextExtractionNotAllowedError to PDFTextExtractionNotAllowed to revert breaking change ([#461](https://github.com/pdfminer/pdfminer.six/pull/461))
- Always try to get CMap, not only for identity encodings ([#438](https://github.com/pdfminer/pdfminer.six/pull/438))
- Recognizing 'trailer' keyword with spaces as prefix or suffix ([#513](https://github.com/pdfminer/pdfminer.six/pull/513))

## [20200720]

Expand Down
9 changes: 5 additions & 4 deletions pdfminer/pdfdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ def load(self, parser):
while True:
try:
(pos, line) = parser.nextline()
line = line.strip()
if not line:
if not line.strip():
continue
except PSEOF:
raise PDFNoValidXRef('Unexpected EOF - file corrupted?')
if not line:
raise PDFNoValidXRef('Premature eof: %r' % parser)
if line.startswith(b'trailer'):
parser.seek(pos)
break
f = line.split(b' ')
f = line.strip().split(b' ')
if len(f) != 2:
error_msg = 'Trailer not found: {!r}: line={!r}'\
.format(parser, line)
Expand All @@ -117,7 +118,7 @@ def load(self, parser):
(_, line) = parser.nextline()
except PSEOF:
raise PDFNoValidXRef('Unexpected EOF - file corrupted?')
f = line.split(b' ')
f = line.strip().split(b' ')
if len(f) != 3:
error_msg = 'Invalid XRef format: {!r}, line={!r}'\
.format(parser, line)
Expand Down