mirror of
https://github.com/FoxxMD/context-mod.git
synced 2026-04-19 03:00:07 -04:00
fix: Fix missing hyphen character on regex for parsing reddit entity name
Reddit users can have hyphens in their names. Slight tradeoff for allowing hyphens for subreddit names (they are non existent) to allow all valid reddit user names is worth it. Found and corrected by @prometheus-22
This commit is contained in:
@@ -611,7 +611,7 @@ export const parseSubredditName = (val:string): string => {
|
||||
return matches[1] as string;
|
||||
}
|
||||
|
||||
export const REDDIT_ENTITY_REGEX: RegExp = /^\s*(?<entityType>\/[ru]\/|[ru]\/|u_)*(?<name>\w+)*\s*$/;
|
||||
export const REDDIT_ENTITY_REGEX: RegExp = /^\s*(?<entityType>\/[ru]\/|[ru]\/|u_)*(?<name>[\w-]+)*\s*$/;
|
||||
export const REDDIT_ENTITY_REGEX_URL = 'https://regexr.com/6bq1g';
|
||||
export const parseRedditEntity = (val:string, defaultUndefinedPrefix: RedditEntityType = 'subreddit'): RedditEntity => {
|
||||
if(val.trim().length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user