mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
change csv and tsv to subtypes when importing ezbookkeeping exported files in import transaction dialog
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { isString } from './common.js';
|
||||
|
||||
export function getFileExtension(filename) {
|
||||
if (!filename || !isString(filename)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const parts = filename.split('.');
|
||||
return parts[parts.length - 1];
|
||||
}
|
||||
|
||||
export function isFileExtensionSupported(filename, supportedExtensions) {
|
||||
if (!supportedExtensions) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const supportedExtensionsArray = supportedExtensions.split(',');
|
||||
const fileExtension = getFileExtension(filename).toLowerCase();
|
||||
|
||||
for (let i = 0; i < supportedExtensionsArray.length; i++) {
|
||||
const supportedExtension = getFileExtension(supportedExtensionsArray[i]).toLowerCase();
|
||||
|
||||
if (supportedExtension === fileExtension) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1308,6 +1308,7 @@ function getAllSupportedImportFileTypes(i18nGlobal, translateFn) {
|
||||
subTypes.push({
|
||||
type: subType.type,
|
||||
displayName: translateFn(subType.name),
|
||||
extensions: subType.extensions
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user