diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index aa9e6a78b..8d099add3 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -282,13 +282,17 @@ class Driver { let html = ''; try { - html = browser.html() - .replace(new RegExp(`(.{${this.options.htmlMaxCols},}[^>]*>)<`, 'g'), (match, p1) => `${p1}\n<`) - .split('\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'); + if ((this.options.htmlMaxCols === 0) && (this.options.htmlMaxRows === 0)) { + html = browser.html().replace(new RegExp('<', 'g'), '\n<'); + } else { + html = browser.html() + .replace(new RegExp(`(.{${this.options.htmlMaxCols},}[^>]*>)<`, 'g'), (match, p1) => `${p1}\n<`) + .split('\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) { this.wappalyzer.log(error.message, 'browser', 'error'); }