diff --git a/services/web/frontend/js/features/pdf-preview/util/output-files.js b/services/web/frontend/js/features/pdf-preview/util/output-files.js index 2c64a78ed8..5b96f177c1 100644 --- a/services/web/frontend/js/features/pdf-preview/util/output-files.js +++ b/services/web/frontend/js/features/pdf-preview/util/output-files.js @@ -104,7 +104,9 @@ export const handleOutputFiles = async (projectId, data) => { const log = await response.text() try { - const { errors, warnings } = new BibLogParser(log, {}).parse() + const { errors, warnings } = new BibLogParser(log, { + maxErrors: 100, + }).parse() accumulateResults({ errors, warnings }, 'BibTeX:') } catch (e) { // BibLog parsing errors are ignored diff --git a/services/web/frontend/js/ide/log-parser/bib-log-parser.js b/services/web/frontend/js/ide/log-parser/bib-log-parser.js index 916e855da1..a7aa241b45 100644 --- a/services/web/frontend/js/ide/log-parser/bib-log-parser.js +++ b/services/web/frontend/js/ide/log-parser/bib-log-parser.js @@ -18,7 +18,7 @@ const MESSAGE_LEVELS = { ERROR: 'error', } -const parserReducer = function (maxErrors) { +const parserReducer = function (maxErrors, buildMaxErrorsReachedMessage) { return function (accumulator, parser) { const consume = function (logText, regex, process) { let match @@ -32,16 +32,18 @@ const parserReducer = function (maxErrors) { // Too many log entries can cause browser crashes // Construct a too many files error from the last match - if (iterationCount >= maxErrors) { - const level = newEntry.level + 's' - newEntry.message = [ - 'Over', - maxErrors, - level, - 'returned. Download raw logs to see full list', - ].join(' ') - newEntry.line = undefined - result.unshift(newEntry) + if (maxErrors != null && iterationCount >= maxErrors) { + if (buildMaxErrorsReachedMessage) { + const level = newEntry.level + 's' + newEntry.message = [ + 'Over', + maxErrors, + level, + 'returned. Download raw logs to see full list', + ].join(' ') + newEntry.line = undefined + result.unshift(newEntry) + } return [result, ''] } @@ -171,11 +173,17 @@ export default class BibLogParser { } // reduce over the parsers, starting with the log text, let [allWarnings, remainingText] = this.warningParsers.reduce( - parserReducer(this.options.maxErrors), + parserReducer( + this.options.maxErrors, + this.options.buildMaxErrorsReachedMessage + ), [[], this.text] ) ;[allErrors, remainingText] = this.errorParsers.reduce( - parserReducer(this.options.maxErrors), + parserReducer( + this.options.maxErrors, + this.options.buildMaxErrorsReachedMessage + ), [[], remainingText] ) result.warnings = allWarnings diff --git a/services/web/frontend/js/ide/pdf/controllers/PdfController.js b/services/web/frontend/js/ide/pdf/controllers/PdfController.js index 99bfae8ed6..2e9a1f47f7 100644 --- a/services/web/frontend/js/ide/pdf/controllers/PdfController.js +++ b/services/web/frontend/js/ide/pdf/controllers/PdfController.js @@ -640,7 +640,10 @@ App.controller( } function processBiber(log) { - const bibLogParser = new BibLogParser(log, { maxErrors: 100 }) + const bibLogParser = new BibLogParser(log, { + maxErrors: 100, + buildMaxErrorsReachedMessage: true, + }) const { errors, warnings } = bibLogParser.parse(log, {}) const all = [].concat(errors, warnings) accumulateResults({ type: 'BibTeX:', all, errors, warnings })