From be9f964c182c747441dae8e23e8c8630cf15cd5d Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Tue, 26 Jan 2021 22:49:01 -0500 Subject: [PATCH] Remove useless escape characters --- .eslintrc.js | 2 -- src/components/itemContextMenu.js | 2 +- src/components/playback/playbackmanager.js | 2 +- src/components/sanitizeFilename.js | 4 ++-- src/components/viewContainer.js | 2 +- src/scripts/browser.js | 20 ++++++++++---------- src/scripts/site.js | 2 +- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d76560604a..10494c1bd9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -99,8 +99,6 @@ module.exports = { 'Windows': 'readonly' }, rules: { - // TODO: Fix warnings and remove these rules - 'no-useless-escape': ['warn'] }, settings: { polyfills: [ diff --git a/src/components/itemContextMenu.js b/src/components/itemContextMenu.js index c8664512ef..eb8d89441c 100644 --- a/src/components/itemContextMenu.js +++ b/src/components/itemContextMenu.js @@ -359,7 +359,7 @@ import toast from './toast/toast'; itemId: itemId, serverId: serverId, title: item.Name, - filename: item.Path.replace(/^.*[\\\/]/, '') + filename: item.Path.replace(/^.*[\\/]/, '') }]); getResolveFunction(getResolveFunction(resolve, id), id)(); }); diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 696e323317..9f97626e56 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -208,7 +208,7 @@ function getMimeType(type, container) { } function getParam(name, url) { - name = name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]'); + name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); const regexS = '[\\?&]' + name + '=([^&#]*)'; const regex = new RegExp(regexS, 'i'); diff --git a/src/components/sanitizeFilename.js b/src/components/sanitizeFilename.js index ffea2a0a6c..77e06d359c 100644 --- a/src/components/sanitizeFilename.js +++ b/src/components/sanitizeFilename.js @@ -1,12 +1,12 @@ // TODO: Check if needed and move to external dependency // From https://github.com/parshap/node-sanitize-filename -const illegalRe = /[\/\?<>\\:\*\|":]/g; +const illegalRe = /[/?<>\\:*|":]/g; // eslint-disable-next-line no-control-regex const controlRe = /[\x00-\x1f\x80-\x9f]/g; const reservedRe = /^\.+$/; const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i; -const windowsTrailingRe = /[\. ]+$/; +const windowsTrailingRe = /[. ]+$/; function isHighSurrogate(codePoint) { return codePoint >= 0xd800 && codePoint <= 0xdbff; diff --git a/src/components/viewContainer.js b/src/components/viewContainer.js index f17d900d7c..9a1f9eee03 100644 --- a/src/components/viewContainer.js +++ b/src/components/viewContainer.js @@ -119,7 +119,7 @@ import Dashboard from '../scripts/clientUtils'; function parseHtml(html, hasScript) { if (hasScript) { html = replaceAll(html, '\x3c!----\x3e', '<\/script>'); + html = replaceAll(html, '--\x3e', ''); } const wrapper = document.createElement('div'); diff --git a/src/scripts/browser.js b/src/scripts/browser.js index ea384bd060..fc0a5d4435 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -138,19 +138,19 @@ function supportsCssAnimation(allowPrefix) { const uaMatch = function (ua) { ua = ua.toLowerCase(); - const match = /(edg)[ \/]([\w.]+)/.exec(ua) || - /(edga)[ \/]([\w.]+)/.exec(ua) || - /(edgios)[ \/]([\w.]+)/.exec(ua) || - /(edge)[ \/]([\w.]+)/.exec(ua) || - /(opera)[ \/]([\w.]+)/.exec(ua) || - /(opr)[ \/]([\w.]+)/.exec(ua) || - /(chrome)[ \/]([\w.]+)/.exec(ua) || - /(safari)[ \/]([\w.]+)/.exec(ua) || - /(firefox)[ \/]([\w.]+)/.exec(ua) || + const match = /(edg)[ /]([\w.]+)/.exec(ua) || + /(edga)[ /]([\w.]+)/.exec(ua) || + /(edgios)[ /]([\w.]+)/.exec(ua) || + /(edge)[ /]([\w.]+)/.exec(ua) || + /(opera)[ /]([\w.]+)/.exec(ua) || + /(opr)[ /]([\w.]+)/.exec(ua) || + /(chrome)[ /]([\w.]+)/.exec(ua) || + /(safari)[ /]([\w.]+)/.exec(ua) || + /(firefox)[ /]([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; - const versionMatch = /(version)[ \/]([\w.]+)/.exec(ua); + const versionMatch = /(version)[ /]([\w.]+)/.exec(ua); let platform_match = /(ipad)/.exec(ua) || /(iphone)/.exec(ua) || diff --git a/src/scripts/site.js b/src/scripts/site.js index 7569c64f28..03084aa4c5 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -55,7 +55,7 @@ window.getWindowLocationSearch = function(win) { // TODO: Move this elsewhere window.getParameterByName = function(name, url) { - name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); + name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); const regexS = '[\\?&]' + name + '=([^&#]*)'; const regex = new RegExp(regexS, 'i'); const results = regex.exec(url || getWindowLocationSearch());