MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
12.02k stars 4.91k forks source link

[Bug]: MetaMask isn't injected if location.pathname suffix is .pdf #20089

Closed wenty22 closed 8 months ago

wenty22 commented 1 year ago

Describe the bug

We have a storage server, when a user accesses a file, needs to connect metamask. However, we found when the file suffix is .pdf, the provider is not injected.

Then we looked at the code and found the pdf xml files are filtered. https://github.com/MetaMask/metamask-extension/blob/fe3e960b62e65e3179e628cc0c1754d151507bfe/shared/modules/provider-injection.js#L38

And we want to know, what's the reason for this? Why suffixes like mp3 mp4 png aren't filtered?

Can this restriction be removed?

Steps to reproduce

  1. Access this link: https://gnfd-testnet-sp-3.bnbchain.org/view/articles/whale.pdf
  2. Can't use metamask, the provider isn't injected

Error messages or log output

No response

Version

10.33.1

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

anaamolnar commented 1 year ago

Hello, @wenty22. Thanks for reporting! I will pass this on to the team.

eligrey commented 1 year ago

If I had to guess it's likely an instance of this extension simply not being coded to handle anything other than HTML document contexts. That would explain the filtering of .xml at least

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 45 days if there is no further activity. The MetaMask team intends on reviewing this issue before close, and removing the stale label if it is still a bug. We welcome new comments on this issue. We do not intend on closing issues if they report bugs that are still reproducible. Thank you for your contributions.

github-actions[bot] commented 8 months ago

This issue was closed because there has been no follow up activity in the last 45 days. If you feel this was closed in error, please reopen and provide evidence on the latest release of the extension. Thank you for your contributions.