Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.4k stars 1.98k forks source link

Link with www. on image results in a faulty link leading to 404-not found #71469

Open mjaragon opened 1 year ago

mjaragon commented 1 year ago

Quick summary

The user added the link: www.noma.dk to an image in their email. image

The link subscribers got was: https://noma.dk/?mailpoet_router&endpoint=track&action=click&data=WyIxMTEiLCJqZTZuOW05bTJnMGtrc3cwb2MwdzBjMGtzMDRja3c0OCIsIjEzIiwiOTJjMTY1MjFiYmFkIixmYWxzZV0

Which re-directed to: https://noma.dk/www.noma.dk, which doesn't exist and landed on a 404-not-found page (until we added a redirect)

Steps to reproduce

  1. Add an image to an email
  2. Add a link to the image starting with www. (no leading "https://" ), example: www.woocommerce.com (or www.noma.dk)
  3. Send the email out
  4. Click on the image in the email

What you expected to happen

Clicking on the link should take me to the link added to the image: www.noma.dk which should be https://noma.dk/

If I use the example "www.woocommerce.com" link instead, I'd expect to go to to the woocommerce site (https://woocommerce.com/)

What actually happened

Clicking on the link redirected me to https://noma.dk/www.noma.dk, which doesn't exist. (We have a redirect now, so it no longer goes to the 404 page) image

When reproducing the error with a test link entered as www.woocommerce.com The link in the image of the email was: https://noma.dk/?mailpoet_router&endpoint=track&action=click&data=WyIxMTEiLCJqZTZuOW05bTJnMGtrc3cwb2MwdzBjMGtzMDRja3c0OCIsIjE3IiwiNjZjOTcwODFhMzQ2IixmYWxzZV0 Which redirects to: https://noma.dk/www.woocommerce.com (and a 404 error)

Context

This is a Team51 partner site hosted on Pressable, using MailPoet Sending Service to send the emails. Relevant P2 post about the project available here: https://wpspecialprojectsp2.wordpress.com/2021/11/17/noma/

Platform (Simple, Atomic, or both?)

Self-hosted

Theme-specific issue?

No response

Browser, operating system and other notes

No response

Reproducibility

Consistent

Severity

All

Available workarounds?

Yes, easy to implement

Workaround details

Create a redirect for the faulty link. But this assumes that the user thinks about this before sending the email (in which case, they'd probably add the https:// in front of the link to avoid the issue anyway)

kavyagokul commented 1 year ago

📌 FINDINGS/SCREENSHOTS/VIDEO

📌 ACTIONS

📌 Message to Author Hi @mjaragon ! Thanks for your first report. Just adding here that this bug should have been filed directly in Mailpoet's repo(I have filed one now)/

mjaragon commented 1 year ago

Thank you @kavyagokul! I'll keep that in mind for the next time we have an issue to report related to MailPoet :)