MM-16548: Fixing bug with empty type in the second line of the bulk import (#11567)

* MM-16548: Fixing bug with empty type in the second line of the bulk import

* Adding tests to this behavior

* Changing the approach to fix the problem
Этот коммит содержится в:
Jesús Espino
2019-07-08 17:17:06 +02:00
коммит произвёл George Goldberg
родитель efc342f294
Коммит c0b51b03de
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@@ -64,11 +64,13 @@ func (a *App) BulkImport(fileReader io.Reader, dryRun bool, workers int) (*model
if importDataFileVersion != 1 {
return model.NewAppError("BulkImport", "app.import.bulk_import.unsupported_version.error", nil, "", http.StatusBadRequest), lineNumber
}
lastLineType = line.Type
continue
}
if line.Type != lastLineType {
if lastLineType != "" {
// Only clear the worker queue if is not the first data entry
if lineNumber != 2 {
// Changing type. Clear out the worker queue before continuing.
close(linesChan)
wg.Wait()