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

Update name distance check to ignore short names in tweet status handling #51

Merged
merged 2 commits into from
Jan 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pages/content/components/twitter/pageHandlers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ export async function handleTweetStatusPage({ twitterCashTags, twitterHashTags,
const handleDistance = levenshtein.get(safeHandle, tweetHandle);
let nameDistance = levenshtein.get(safeName, displayName);

if (safeName.length === 0 && displayName.length === 0)
nameDistance = 10; // if both names are empty, ignore this check
if (safeName.length < 4 || displayName.length < 4)
nameDistance = 10; // if either of the name is too short, then ignore this check

// if the tweet handle is the same as the page handle, then it's sus. Add red background the tweet
// [can improve due to false negatives with homoglyphic attacks in the username that cant be detected by equality. maybe use levenshtein distance fuzzy matching on username as well]
Expand Down