jb2 判断

This commit is contained in:
Donal 2020-09-11 15:03:51 +08:00
parent c093128324
commit 78fe22cee0
2 changed files with 2 additions and 4 deletions

View File

@ -507,7 +507,7 @@ export default {
if (item['@_Type'].toLowerCase() === 'image') {
const format = item['@_Format'];
const ext = getExtensionByPath(file);
if (format && format.toLowerCase() === 'gbig2' || ext && ext.toLowerCase() === 'jb2') {
if ((format && (format.toLowerCase() === 'gbig2' || format.toLowerCase() === 'jb2')) || ext && (ext.toLowerCase() === 'jb2' || ext.toLowerCase() === 'gbig2')) {
const jbig2 = await this.getImageArrayFromZip(file);
this.multiMediaResObj[item['@_ID']] = jbig2;
} else {

View File

@ -159,9 +159,7 @@ export const replaceFirstSlash = function (str) {
export const getExtensionByPath = function (path) {
if (!path && typeof path !== "string") return "";
var matches = /\.([a-z]+)$/.exec(path);
if (!matches) return "";
return matches[1] || "";
return path.substring(path.lastIndexOf('.') + 1);
}