TwisterMc / pdfjs-viewer-shortcode

A Wordpress plugin for embedding PDFs using Mozilla's Excellent PDF.js
https://wordpress.org/plugins/pdfjs-viewer-shortcode/
Apache License 2.0
7 stars 5 forks source link

Blocked by Microsoft Defender SmartScreen in Edge #26

Open ibrokemycomputer opened 10 months ago

ibrokemycomputer commented 10 months ago

Hello,

I noticed that certain PDFs are blocked in Edge by Microsoft Defender SmartScreen only when using the pdfjs URL. Accessing them directly is fine.

Bad embed (blocked): https://dev.kla.com/advance/innovation/spts-co-develops-drug-administering-microneedles Bad URL (blocked): https://www.kla.com/wp-content/plugins/pdfjs-viewer-shortcode/pdfjs/web/viewer.php?file=https://www.kla.com/wp-content/uploads/microneedles.pdf&attachment_id=0&dButton=true&pButton=true&oButton=false&sButton=true#zoom=auto&pagemode=none&_wpnonce=783542386d Raw URL (works): https://www.kla.com/wp-content/uploads/microneedles.pdf

I noticed that the zoom parameter has a hash in front instead of an ampersand. Changing the # to & on embed.php lines 131 and 136 fixed the issue with both the embed and the "fullscreen" URL.

Ill submit a pull request here shortly. Thank you!

ibrokemycomputer commented 10 months ago

Unfortunately, I had to apply a quick patch since it is a production site, but if you download that PDF and test the # vs & in the URL you'll see the issue.

However, I believe that it should be a & anyway to be a valid URL but 🤷


Edit: The "bad URL" link is still broken/showing the issue, but the embed is patched.

TwisterMc commented 9 months ago

Interesting. If this fixes all the Edge weirdness, I'll be so happy. Also, no idea how I couldn't have noticed that.