From 598c6620d7f72929e4f143e8fb504ab988253fad Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Sat, 21 Nov 2020 13:15:49 +0100 Subject: [PATCH] fix: correctly detect format OBSVER1 if there is no header, just data This is required for OBS compatibility, which drops the header line on upload. --- logic/tracks.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/logic/tracks.js b/logic/tracks.js index 1219e53..43a4b88 100644 --- a/logic/tracks.js +++ b/logic/tracks.js @@ -73,6 +73,13 @@ function detectFormat(body) { return 1; } + // If we immediately start with data (a date, formatted as DD.MM.YYYY), then + // we have an old OBS not sending the header. It must therefore be old + // format, too. + if (/^[0-9]{2}\.[0-9]{2}\.[0-9]{4};/.test(firstLine)) { + return 1; + } + return 'invalid'; }