Skip to content

Commit 68ff3ec

Browse files
committed
Fixed bug
1 parent 58e8a87 commit 68ff3ec

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ydb/public/lib/ydb_cli/import/import.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,11 @@ TStatus TImportFileClient::UpsertCsv(IInputStream& input, const TString& dbPath,
394394
if (settings.HeaderRow_) {
395395
headerRow = settings.HeaderRow_;
396396
}
397-
if (headerRow.back() == '\n') {
398-
headerRow.pop_back();
397+
if (headerRow.EndsWith("\r\n")) {
398+
headerRow.erase(headerRow.Size() - 2);
399+
}
400+
if (headerRow.EndsWith("\n")) {
401+
headerRow.erase(headerRow.Size() - 1);
399402
}
400403
if (headerRow.EndsWith(settings.Delimiter_)) {
401404
RemoveLastDelimiter = true;
@@ -511,8 +514,11 @@ TStatus TImportFileClient::UpsertCsvByBlocks(const TString& filePath, const TStr
511514
if (settings.HeaderRow_) {
512515
headerRow = settings.HeaderRow_;
513516
}
514-
if (headerRow.back() == '\n') {
515-
headerRow.pop_back();
517+
if (headerRow.EndsWith("\r\n")) {
518+
headerRow.erase(headerRow.Size() - 2);
519+
}
520+
if (headerRow.EndsWith("\n")) {
521+
headerRow.erase(headerRow.Size() - 1);
516522
}
517523
if (headerRow.EndsWith(settings.Delimiter_)) {
518524
RemoveLastDelimiter = true;

0 commit comments

Comments
 (0)