From f5810319fbbb0e01900ae9e26efab2dad86cee3b Mon Sep 17 00:00:00 2001 From: Teppo Kurki Date: Mon, 10 Feb 2025 18:59:30 +0200 Subject: [PATCH] fix: multiplexed playback with empty lines (#1884) Encountered a multiplexed log file with empty line in the beginning. Fix by skipping empty lines until we see a line that we can recognize. --- packages/streams/autodetect.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/streams/autodetect.js b/packages/streams/autodetect.js index 5acca252a..87421f5ef 100644 --- a/packages/streams/autodetect.js +++ b/packages/streams/autodetect.js @@ -143,6 +143,12 @@ require('util').inherits(ToTimestamped, Transform) // runs only once, self-assigns the actual transform functions // on first call ToTimestamped.prototype._transform = function (msg, encoding, done) { + //ignore empty lines in the beginning of the file, encountered in some cases + if (msg.trim().length === 0) { + done() + return + } + const line = msg.toString() this.multiplexedFormat = line.length > 16 && line.charAt(13) === ';' && line.split(';').length >= 3