Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hacker news and bitcointalk dupes #781

Merged
merged 6 commits into from
Feb 2, 2024

Conversation

mzivil
Copy link
Contributor

@mzivil mzivil commented Feb 2, 2024

Fixes #768

Looks like there was a regression at some point that made all hacker news links and all bitcointalk links appear as dupes.

Originally, we expected that these links would be caught by the whitelist.includes(uri) if-condition, but now uri is a regex string (like (%.)?bitcointalk.org(:[0-9]+)?/index.php) so we never matched correctly against the whitelist values.

This returns the original behavior of checking the whitelist against the URL's hostname + pathname. It also renames a variable and reassigns the previously mutated variables to new variables for clarity.

It looks like a regression was introduced at some point, because
the `uri` that's compared against the `whitelist` is a regular
expression and not the url hostname + pathname as it was originally
written.

This brings back the original behavior of comparing the whitelist
against the hostname + pathname
@mzivil mzivil marked this pull request as ready for review February 2, 2024 21:12
@huumn
Copy link
Member

huumn commented Feb 2, 2024

Excellent! Figures there was a regression at one point

@huumn huumn merged commit cb5c12b into stackernews:master Feb 2, 2024
1 check passed
@mzivil mzivil deleted the fix-hn-and-bitcointalk-dupes branch February 2, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Completely unrelated HN links are treated as dupes
2 participants