1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-21 01:39:04 +02:00

fix(menu-item): update condition in sanitizeString function

This commit is contained in:
cvillasenor 2024-07-17 08:01:47 -06:00
parent 8114487c6e
commit c34934d8ca

View File

@ -62,10 +62,18 @@ export const titleCaseEquals = function(str1, str2) {
* Whether the string contains a Hex Code * Whether the string contains a Hex Code
*/ */
export const containsHexCode = (string) => { export const containsHexCode = (string) => {
return /[a-zA-Z\040]*(&#x[0-9a-fA-F]{2,4};)[a-zA-Z\040]*/.test(string); return /(&#x[0-9a-fA-F]{2,4};)/.test(string);
}; };
/**
*
* @param {string} string
* The string that will be sanitized
*
* @return {string}
* Modified string without problematic characters
*/
export const sanitizeString = (string) => { export const sanitizeString = (string) => {
string = string.replace(/[^a-z0-9 áéíóúñü\&#;_]/gim, ''); string = string.replace(/(?!&#x[0-9a-fA-F]{2,4};)([&\/><{}`=&])/, '');
return string.trim(); return string.trim();
}; };