Skip to content

Commit

Permalink
Merge pull request #51 from DefiLlama/emoji-names
Browse files Browse the repository at this point in the history
Update name distance check to ignore short names in tweet status handling
  • Loading branch information
g1nt0ki authored Jan 26, 2025
2 parents 2980294 + bd2fc6d commit ba002a6
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit ba002a6

Please sign in to comment.