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

Do not choke on PDF specs #1435

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Do not choke on PDF specs #1435

merged 1 commit into from
Nov 29, 2023

Conversation

tidoust
Copy link
Member

@tidoust tidoust commented Nov 29, 2023

When given a PDF URL, Reffy crashed because Puppeteer rejects them.

This update makes Reffy (roughly) detect PDF URLs and silently skip them, returning empty extracts instead.

The detection of PDF URLs currently relies on them ending with .pdf, which is not ideal but avoids more complex code (network interception is done at the request stage. To detect a PDF mime type, the interception would rather need to be done when a response is received from the server).

Internally, a PDF URL is represented as an empty HTML document, so nothing will be extracted. The title extraction now reuses the information from browser-specs when it cannot extract the title, to avoid return "No title found for X" whereas we actually have the info.

When given a PDF URL, Reffy would crash because Puppeteer rejects them.

This update makes Reffy (roughly) detect PDF URLs and silently skip them,
returning empty extracts instead.

The detection of PDF URLs currently relies on them ending with `.pdf`, which is
not ideal but avoids more complex code (network interception is done at the
request stage. To detect a PDF mime type, the interception would rather need to
be done when a response is received from the server).

Internally, a PDF URL is the same thing as an empty HTML document, so nothing
will be extracted. The title extraction now reuses the information from
browser-specs when it cannot extract the title, to avoid return "No title found
for X" whereas we actually have the info.
@tidoust tidoust merged commit a570391 into main Nov 29, 2023
1 check passed
@tidoust tidoust deleted the pdf branch November 29, 2023 15:02
tidoust added a commit that referenced this pull request Dec 1, 2023
New features:
- Do not choke on PDF specs (#1435)

Bug fixes:
- Make refs extraction more flexible and stable, add tests (#1434)

Dependencies bumped:
- Bump rollup from 4.5.2 to 4.6.1 (#1436)
- Bump undici from 5.28.0 to 5.28.2 (#1438)
- Bump web-specs from 2.74.1 to 2.75.1 (#1437)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants