fix: detect version 2 format when metadata line is missing

This commit is contained in:
Paul Bienkowski 2020-11-21 19:36:27 +01:00
parent 1a00e7b010
commit 02f8258a91

View file

@ -108,6 +108,12 @@ function detectFormat(body) {
return Number(match[2]); return Number(match[2]);
} }
// If we have no metadata line, but start immediately with a header, AND it contains
// `;Rus`, it is a version 2
if (/^Date;Time.*;Rus/.test(firstLine)) {
return 2;
}
// If we have no metadata line, but start immediately with a header, it is // If we have no metadata line, but start immediately with a header, it is
// format version 1. // format version 1.
if (/^Date;Time/.test(firstLine)) { if (/^Date;Time/.test(firstLine)) {
@ -223,13 +229,13 @@ function* parseObsver2(body) {
switch (type) { switch (type) {
case 'int': case 'int':
return parseInt(value); return _parseInt(value);
case 'float': case 'float':
return parseFloat(value); return _parseFloat(value);
case 'string': case 'string':
return value; return _parseString(value);
} }
}, },
})) { })) {