Skip to content

Commit 59d7fbd

Browse files
committed
[Import] Fix automatic parser selection
1 parent 6d43ffa commit 59d7fbd

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/components/admin/texts/TextUpload.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,14 @@
114114
'type': 'error',
115115
'title': 'File Upload'
116116
} );
117-
else console.error( error );
117+
else {
118+
console.error( error );
119+
notifications.notify( {
120+
'text': 'An unknown error occurred. See console for more information',
121+
'type': 'error',
122+
'title': 'File Upload'
123+
} );
124+
}
118125
119126
uploading.value = false;
120127

src/ts/dataImport/importers/characterBoxes/multipleTextsPerFile.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export const characterBoxMultipleTextImporter: ImportConfig<ImportCharacterBound
3333
if ( !inputElement.files || !inputElement.files[0] ) throw new MissingFilesError();
3434

3535
return runParse( await fileLoaderString( inputElement.files[ 0 ] ), textId );
36+
},
37+
'canParse': ( header: string[] ) => {
38+
return header.includes( 'text' );
3639
}
3740
};
3841

src/ts/dataImport/importers/characterBoxes/singleTextPerFile.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export const characterBoxSingleTextImporter: ImportConfig<ImportCharacterBoundin
2424
if ( !inputElement.files || !inputElement.files[0] ) throw new MissingFilesError();
2525

2626
return runParse( await fileLoaderString( inputElement.files[ 0 ] ) );
27+
},
28+
'canParse': ( header: string[] ) => {
29+
return !header.includes( 'text' );
2730
}
2831
};
2932

0 commit comments

Comments
 (0)