execl问题修复
This commit is contained in:
1 parent
be7d765018
commit
07b23fce9e
18 files changed
+287
-27
No files matched your search
@@ -457,9 +457,14 @@
|
||||
return '';
|
||||
}
|
||||
|
||||
function normalizePassengerTsvText(text) {
|
||||
// Tabs represent columns, including empty final fields; trim only boundary newlines.
|
||||
return String(text || '').replace(/\r\n?/g, '\n').replace(/^\n+|\n+$/g, '');
|
||||
}
|
||||
|
||||
function buildPassengerTsv(passengerList = {}) {
|
||||
if (typeof passengerList.text === 'string' && passengerList.text.trim()) {
|
||||
return passengerList.text.trim().replace(/\r\n?/g, '\n');
|
||||
return normalizePassengerTsvText(passengerList.text);
|
||||
}
|
||||
const rows = Array.isArray(passengerList.rows) ? passengerList.rows : [];
|
||||
if (!rows.length) return '';
|
||||
@@ -470,7 +475,7 @@
|
||||
}
|
||||
|
||||
function passengerLeaderFromTsv(text) {
|
||||
const lines = String(text || '').trim().replace(/\r\n?/g, '\n').split('\n').filter((line) => line.length > 0);
|
||||
const lines = normalizePassengerTsvText(text).split('\n').filter((line) => line.length > 0);
|
||||
const headers = String(lines[0] || '').split('\t').map((header) => header.trim());
|
||||
if (headers.length !== PASSENGER_HEADERS.length
|
||||
|| headers.some((header, index) => header !== PASSENGER_HEADERS[index])) {
|
||||
@@ -1110,7 +1115,7 @@
|
||||
blockers.push('data.passenger_list.text 必须包含本次提供的 13 列名单 TSV。');
|
||||
return;
|
||||
}
|
||||
const lines = value.text.trim().replace(/\r\n?/g, '\n').split('\n').filter((line) => line.length > 0);
|
||||
const lines = normalizePassengerTsvText(value.text).split('\n').filter((line) => line.length > 0);
|
||||
const headers = String(lines[0] || '').split('\t');
|
||||
if (headers.length !== PASSENGER_HEADERS.length || headers.some((header, index) => header.trim() !== PASSENGER_HEADERS[index])) blockers.push('名单 TSV 必须使用规定的 13 列表头和顺序。');
|
||||
if (lines.length - 1 !== value.row_count) blockers.push('data.passenger_list.row_count 与 TSV 数据行数不一致。');
|
||||
|
||||
Reference in new issue
Block a user