Remove split / concat when htmlMaxRows and htmlMaxCols is 0 (#2539)

main
Zsombor Paróczi 6 years ago committed by Elbert Alias
parent aca25bfb07
commit ba6487640d

@ -282,6 +282,9 @@ class Driver {
let html = ''; let html = '';
try { try {
if ((this.options.htmlMaxCols === 0) && (this.options.htmlMaxRows === 0)) {
html = browser.html().replace(new RegExp('<', 'g'), '\n<');
} else {
html = browser.html() html = browser.html()
.replace(new RegExp(`(.{${this.options.htmlMaxCols},}[^>]*>)<`, 'g'), (match, p1) => `${p1}\n<`) .replace(new RegExp(`(.{${this.options.htmlMaxCols},}[^>]*>)<`, 'g'), (match, p1) => `${p1}\n<`)
.split('\n') .split('\n')
@ -289,6 +292,7 @@ class Driver {
.concat(html.slice(html.length - this.options.htmlMaxRows / 2)) .concat(html.slice(html.length - this.options.htmlMaxRows / 2))
.map(line => line.substring(0, this.options.htmlMaxCols)) .map(line => line.substring(0, this.options.htmlMaxCols))
.join('\n'); .join('\n');
}
} catch (error) { } catch (error) {
this.wappalyzer.log(error.message, 'browser', 'error'); this.wappalyzer.log(error.message, 'browser', 'error');
} }