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