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

[Bug]: Auto-linking creates "pointless" mailto:-links in some cases #19462

Closed
Snuffleupagus opened this issue Feb 10, 2025 · 1 comment · Fixed by #19470
Closed

[Bug]: Auto-linking creates "pointless" mailto:-links in some cases #19462

Snuffleupagus opened this issue Feb 10, 2025 · 1 comment · Fixed by #19470
Assignees
Labels

Comments

@Snuffleupagus
Copy link
Collaborator

Attach (recommended) or Link to PDF file

https://github.com/mozilla/pdf.js/blob/master/test/pdfs/pdf.pdf.link

Web browser and its version

N/A

Operating system and its version

N/A

PDF.js version

master, or any version after PR #19110

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. Load http://localhost:8888/web/viewer.html?file=/test/pdfs/pdf.pdf#page=68
  2. Note that the JD?M$0QP)lKn06l1apKDC@\qJ4B!!(5m+j.7F790m text is clickable.

What is the expected behavior?

Since that text doesn't make sense as an email address, there should be no link created.

Note: Acrobat Reader does not create a link for that piece of text.

What went wrong?

The text become a mailto:-link, despite not making sense as an email address.

Link to a viewer

No response

Additional context

No response

@nicolo-ribaudo
Copy link
Contributor

@ryzokuken Similarly to how here is some logic to actually check that an http URL is valid, you should probably split the email at @ and check that whatever comes after the @ is, when prefixed to HTTP, a valid domain.

ryzokuken added a commit to ryzokuken/pdf.js that referenced this issue Feb 11, 2025
This commit fixes some edge cases in the autolinking logic and adds
tests for them. It fixes the issues with regexp, email validation as
well as link annotations being injected multiple times on zoom.

Fixes: mozilla#19462
ryzokuken added a commit to ryzokuken/pdf.js that referenced this issue Feb 11, 2025
This commit fixes some edge cases in the autolinking logic and adds
tests for them. It fixes the issues with regexp, email validation as
well as link annotations being injected multiple times on zoom.

Fixes: mozilla#19462
ryzokuken added a commit to ryzokuken/pdf.js that referenced this issue Feb 12, 2025
This commit fixes some edge cases in the autolinking logic and adds
tests for them. It fixes the issues with regexp and email validation.

Fixes: mozilla#19462
ryzokuken added a commit to ryzokuken/pdf.js that referenced this issue Feb 12, 2025
Fix some edge cases in the autolinking logic with the regex as well as
validating email domains and add unit tests for them.

Fixes: mozilla#19462
ryzokuken added a commit to ryzokuken/pdf.js that referenced this issue Feb 14, 2025
Fix some edge cases in the autolinking logic with the regex as well as
validating email domains and add unit tests for them.

Fixes: mozilla#19462
ryzokuken added a commit to ryzokuken/pdf.js that referenced this issue Feb 18, 2025
Fix some edge cases in the autolinking logic with the regex as well as
validating email domains and add unit tests for them.

Fixes: mozilla#19462
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 a pull request may close this issue.

3 participants