Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #68 from NavigoLearn/master
Browse files Browse the repository at this point in the history
Implement URL filtering in profanity check in staging
  • Loading branch information
sopyb authored Sep 26, 2023
2 parents 36e2c0e + 776aef5 commit 5c5e765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "navigo-learn-api",
"version": "2.0.8",
"version": "2.0.9",
"description": "Navigo Learn API",
"repository": "https://github.com/NavigoLearn/API.git",
"author": "Navigo",
Expand Down
3 changes: 3 additions & 0 deletions src/util/ProfanityFilter/ProfanityFilterUtil.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import wordList from '@src/util/ProfanityFilter/WordList';

const URLRegex = /https?:\/\/[^\s]+/g;

export function checkWordProfanity(word: string): boolean {
if (URLRegex.test(word)) return false;
return wordList.some((wordRegex) => wordRegex.test(word.toLowerCase()));
}

Expand Down

0 comments on commit 5c5e765

Please sign in to comment.