Fixed a Bug where csv is treated as txt file by import wizard (#11271)

* Add CodeQL Analysis workflow (#10195)

* Add CodeQL Analysis workflow

* Fix path

* Fixed the bug where CSVs were treated as TXT files

Co-authored-by: Justin Hutchings <jhutchings1@users.noreply.github.com>
This commit is contained in:
Aasim Khan
2020-07-09 15:01:48 -07:00
committed by GitHub
parent c334a95d35
commit 1796b519e5

View File

@@ -201,11 +201,24 @@ export class FileConfigPage extends ImportPage {
if (nameEnd === 0) {
nameEnd = fileUri.path.length;
}
this.model.fileType = 'TXT';
let extension = fileUri.path.substring(nameEnd + 1, fileUri.path.length);
if (extension.toLowerCase() === 'json') {
this.model.fileType = 'JSON';
/**
* FileType should be TXT for txt files and files with unknown types.
* CSVs and TSVs are treated as the CSV file while learning in the prose library.
*/
switch (extension.toLowerCase()) {
case 'json':
this.model.fileType = 'JSON';
break;
case 'csv':
case 'tsv':
this.model.fileType = 'CSV';
break;
default:
this.model.fileType = 'TXT';
}
this.tableNameTextBox.value = fileUri.path.substring(nameStart + 1, nameEnd);