revert to regex to address issue discovered by CodeQL

This commit is contained in:
El RIDO 2025-10-07 00:44:53 +02:00
parent e35894e4f8
commit 5ae2ebcc77
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92

View file

@ -82,7 +82,8 @@ describe('Helper', function () {
'ignores non-URL content',
'string',
function (content) {
content = content.replace(/\r|\f/g, '\n').replace('\u0000', '').replace('\u000b', '');
// eslint-disable-next-line no-control-regex
content = content.replace(/\r|\f/g, '\n').replace(/\u0000/g, '').replace(/\u000b/g, '');
let clean = jsdom();
$('body').html('<div id="foo"></div>');
let e = $('#foo');
@ -100,8 +101,10 @@ describe('Helper', function () {
jsc.array(common.jscHashString()),
'string',
function (prefix, url, fragment, postfix) {
prefix = prefix.replace(/\r|\f/g, '\n').replace('\u0000', '').replace('\u000b', '');
postfix = ' ' + postfix.replace('\r', '\n').replace('\u0000', '');
// eslint-disable-next-line no-control-regex
prefix = prefix.replace(/\r|\f/g, '\n').replace(/\u0000/g, '').replace(/\u000b/g, '');
// eslint-disable-next-line no-control-regex
postfix = ' ' + postfix.replace(/\r/g, '\n').replace(/\u0000/g, '');
url.fragment = fragment.join('');
let urlString = common.urlToString(url),
clean = jsdom();
@ -132,8 +135,10 @@ describe('Helper', function () {
jsc.array(common.jscQueryString()),
'string',
function (prefix, query, postfix) {
prefix = prefix.replace(/\r|\f/g, '\n').replace('\u0000', '').replace('\u000b', '');
postfix = ' ' + postfix.replace('\r', '\n').replace('\u0000', '');
// eslint-disable-next-line no-control-regex
prefix = prefix.replace(/\r|\f/g, '\n').replace(/\u0000/g, '').replace(/\u000b/g, '');
// eslint-disable-next-line no-control-regex
postfix = ' ' + postfix.replace(/\r/g, '\n').replace(/\u0000/g, '');
let url = 'magnet:?' + query.join('').replace(/^&+|&+$/gm, ''),
clean = jsdom();
$('body').html('<div id="foo"></div>');