fix: Render valid urls only in custom attributes (#3921)

This commit is contained in:
Muhsin Keloth
2022-02-07 13:04:27 +05:30
committed by GitHub
parent 047070ad87
commit 9f37a6e2ba
5 changed files with 23 additions and 21 deletions

View File

@@ -37,3 +37,9 @@ export const accountIdFromPathname = pathname => {
const accountId = isScoped ? Number(urlParam) : '';
return accountId;
};
export const isValidURL = value => {
/* eslint-disable no-useless-escape */
const URL_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm;
return URL_REGEX.test(value);
};