Skip to content

Fix misleading link check on texts that have something that might resemble a protocol#2714

Merged
huumn merged 1 commit into
stackernews:masterfrom
Soxasora:fix_misleading_mislabel
Dec 26, 2025
Merged

Fix misleading link check on texts that have something that might resemble a protocol#2714
huumn merged 1 commit into
stackernews:masterfrom
Soxasora:fix_misleading_mislabel

Conversation

@Soxasora
Copy link
Copy Markdown
Member

@Soxasora Soxasora commented Dec 26, 2025

Description

Context: https://stacker.news/items/1374726
Before checking if the linkText is misleading, we try to parse the linkText as a URL and check if the origin matches the href origin. Texts that have something that might resemble a protocol, e.g. Foo:, will fail the check even though it's not a real protocol.

This PR fixes this issue by checking if origin actually got parsed, if it returns 'null' then it's not a real protocol and we can move on to the second misleading check (the regex).

Screenshots

tbd

Checklist

Are your changes backward compatible? Please answer below:

For example, a change is not backward compatible if you removed a GraphQL field or dropped a database column.
Yes
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
7, but will QA with more examples

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
n/a

Did you introduce any new environment variables? If so, call them out explicitly here:
n/a

Did you use AI for this? If so, how much did it assist you?
No, observed that origin can be null if the protocol is not http(s) or ftp and so on.


Note

Prevents false positives in misleading link detection.

  • Updates isMisleadingLink to only compare textUrl.origin to hrefUrl.origin when textUrl.origin !== 'null'
  • Ensures texts that resemble protocols but aren't valid URLs (e.g., Foo:) aren't flagged as misleading

Written by Cursor Bugbot for commit 4afa64f. This will update automatically on new commits. Configure here.

@Soxasora Soxasora changed the title check origin only if it doesn't have 'null' value, meaning the text d… Fix misleading link check on texts that has something that might resemble a protocol Dec 26, 2025
@Soxasora Soxasora changed the title Fix misleading link check on texts that has something that might resemble a protocol Fix misleading link check on texts that have something that might resemble a protocol Dec 26, 2025
@huumn huumn merged commit f58e7e7 into stackernews:master Dec 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants