[GH-ISSUE #357] Link Check: localhost links not detected #237

Closed
opened 2026-03-15 13:22:02 +03:00 by kerem · 5 comments
Owner

Originally created by @dregad on GitHub (Sep 4, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/357

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.
github.com/axllent/mailpit@dc1a16ed5c/internal/linkcheck/main.go (L13)

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

Originally created by @dregad on GitHub (Sep 4, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/357 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](https://github.com/user-attachments/assets/3733dbac-69dc-41e6-99f4-e6e717182ccd) ![image](https://github.com/user-attachments/assets/52165505-c419-449b-b5db-a8347d283c01) 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 ❤️
kerem closed this issue 2026-03-15 13:22:07 +03:00
Author
Owner

@dregad commented on GitHub (Sep 4, 2024):

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.

<!-- gh-comment-id:2328797944 --> @dregad commented on GitHub (Sep 4, 2024): 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.
Author
Owner

@dregad commented on GitHub (Sep 4, 2024):

Same behavior confirmed with v1.20.3.

<!-- gh-comment-id:2328937096 --> @dregad commented on GitHub (Sep 4, 2024): Same behavior confirmed with v1.20.3.
Author
Owner

@axllent commented on GitHub (Sep 5, 2024):

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?

<!-- gh-comment-id:2330647920 --> @axllent commented on GitHub (Sep 5, 2024): 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](https://github.com/axllent/mailpit/releases/tag/v1.20.4). Please confirm this new release fixes the issue for you?
Author
Owner

@dregad commented on GitHub (Sep 5, 2024):

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

<!-- gh-comment-id:2330705257 --> @dregad commented on GitHub (Sep 5, 2024): Thanks for responding so quickly. I think your fix should do the trick, will test and confirm later today!
Author
Owner

@dregad commented on GitHub (Sep 5, 2024):

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

<!-- gh-comment-id:2331144946 --> @dregad commented on GitHub (Sep 5, 2024): Confirmed working OK in 1.20.4, thank you very much ! 🚀
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#237
No description provided.