axllent / mailpit

An email and SMTP testing tool with API for developers
https://mailpit.axllent.org
MIT License
6.18k stars 153 forks source link

Link Check: localhost links not detected #357

Closed dregad closed 2 months ago

dregad commented 2 months ago

Hello @axllent,

I was testing the LinkCheck feature, and noticed that localhost links (which I frequently use while developing) are not detected (http://127.0.0.1 works).

php > mail('test@localhost','Test plain link','http://localhost');

image image

I guess this could be fixed with a small adjustment to the Regex. e.g. appending |localhost at the end of the 2nd capturing group. https://github.com/axllent/mailpit/blob/dc1a16ed5c065486b5edd24623489b935c7ed4d3/internal/linkcheck/main.go#L13

PS: many thanks for MailPit, it's awesome ❤️

dregad commented 2 months ago

Sorry, forgot to mention this is with v1.18.3. I realize it's somewhat out of date, but I can't upgrade just now, and as far as I can tell the regex is the same in 1.20.3 so I don't think it will make any difference but I'll test again later with the latest version.

dregad commented 2 months ago

Same behavior confirmed with v1.20.3.

axllent commented 2 months ago

Hi @dregad - I can confirm your issue - the frontend JavaScript was far more relaxed in how it detected a "valid" URL vs: the "backend" for link checking. I have just pushed a fix and released it as part of v1.20.4. Please confirm this new release fixes the issue for you?

dregad commented 2 months ago

Thanks for responding so quickly. I think your fix should do the trick, will test and confirm later today!

dregad commented 2 months ago

Confirmed working OK in 1.20.4, thank you very much ! 🚀