Fix low severity issues in the JavaScript (#3342)

This commit is contained in:
Eric Cornelissen 2020-07-28 13:33:40 +03:00 committed by GitHub
parent d4b07ad447
commit 7fb4ff6395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -90,7 +90,7 @@ module.exports = {
iconIgnored.size.hasOwnProperty(iconPath) || iconIgnored.size.hasOwnProperty(iconPath) ||
iconIgnored.center.hasOwnProperty(iconPath) iconIgnored.center.hasOwnProperty(iconPath)
) { ) {
return return;
} }
const targetCenter = iconSize / 2; const targetCenter = iconSize / 2;

View File

@ -28,7 +28,7 @@ const { titleToFilename } = require("./utils");
// Local helper functions // Local helper functions
function escape(value) { function escape(value) {
return value.replace(/'/g, "\\'"); return value.replace(/(?<!\\)'/g, "\\'");
} }
function iconToKeyValue(icon) { function iconToKeyValue(icon) {
const iconTitle = escape(icon.title); const iconTitle = escape(icon.title);

View File

@ -32,7 +32,7 @@ module.exports = {
*/ */
htmlFriendlyToTitle: htmlFriendlyTitle => ( htmlFriendlyToTitle: htmlFriendlyTitle => (
htmlFriendlyTitle htmlFriendlyTitle
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "") .replace(/&apos;/g, "")
.replace(/&amp;/g, "&")
) )
} }

View File

@ -59,7 +59,7 @@
// - https://davidwalsh.name/query-string-javascript // - https://davidwalsh.name/query-string-javascript
// - https://github.com/WebReflection/url-search-params // - https://github.com/WebReflection/url-search-params
function getUrlParameter(parameter) { function getUrlParameter(parameter) {
name = parameter.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var name = parameter.replace(/[\[]/g, '\\[').replace(/[\]]/g, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search); var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
@ -84,9 +84,9 @@
queryLetters = query.split(''); queryLetters = query.split('');
var matchedIcons = icons.filter(function(iconName, iconIndex) { var matchedIcons = icons.filter(function(iconName, iconIndex) {
var element = $icons[iconIndex], var element = $icons[iconIndex];
score = iconName.length - query.length; var score = iconName.length - query.length;
index = 0; var index = 0;
for (var i = 0; i < queryLetters.length; i++) { for (var i = 0; i < queryLetters.length; i++) {
var letter = queryLetters[i]; var letter = queryLetters[i];