mirror of
https://github.com/videojs/video.js.git
synced 2025-07-17 01:42:41 +02:00
fix(menu-item): update condition in sanitizeString function
This commit is contained in:
@ -62,10 +62,18 @@ export const titleCaseEquals = function(str1, str2) {
|
||||
* Whether the string contains a Hex Code
|
||||
*/
|
||||
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) => {
|
||||
string = string.replace(/[^a-z0-9 áéíóúñü\&#;_]/gim, '');
|
||||
string = string.replace(/(?!&#x[0-9a-fA-F]{2,4};)([&\/><{}`=&])/, '');
|
||||
return string.trim();
|
||||
};
|
||||
|
Reference in New Issue
Block a user