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:
parent
8114487c6e
commit
c34934d8ca
@ -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();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user