diff --git a/app/src/asset/index.ts b/app/src/asset/index.ts
index d0cc99e5e..0388f3dd4 100644
--- a/app/src/asset/index.ts
+++ b/app/src/asset/index.ts
@@ -86,7 +86,7 @@ export class Asset extends Model {
}
private render() {
- const type = this.path.substr(this.path.lastIndexOf(".")).toLowerCase();
+ const type = this.path.substr(this.path.lastIndexOf(".")).toLowerCase().split("?")[0];
if (Constants.SIYUAN_ASSETS_IMAGE.includes(type)) {
this.element.innerHTML = `
`;
} else if (Constants.SIYUAN_ASSETS_AUDIO.includes(type)) {
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index f1c61f0d8..9f9d0c5de 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -74,7 +74,7 @@ export const openFileById = async (options: {
};
export const openAsset = (app: App, assetPath: string, page: number | string, position?: string) => {
- const suffix = pathPosix().extname(assetPath.split("?page")[0]);
+ const suffix = pathPosix().extname(assetPath).split("?")[0];
if (!Constants.SIYUAN_ASSETS_EXTS.includes(suffix)) {
return;
}
@@ -421,7 +421,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
const newTab = (options: IOpenFileOptions) => {
let tab: Tab;
if (options.assetPath) {
- const suffix = pathPosix().extname(options.assetPath.split("?page")[0]);
+ const suffix = pathPosix().extname(options.assetPath).split("?")[0];
if (Constants.SIYUAN_ASSETS_EXTS.includes(suffix)) {
let icon = "iconPDF";
if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) {
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts
index 115d436f0..255a67aa3 100644
--- a/app/src/menus/commonMenuItem.ts
+++ b/app/src/menus/commonMenuItem.ts
@@ -727,7 +727,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
});
/// #else
if (isLocalPath(src)) {
- if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname(src)) &&
+ if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname(src).split("?")[0]) &&
(!src.endsWith(".pdf") ||
(src.endsWith(".pdf") && !src.startsWith("file://")))
) {
diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts
index b9a0a7656..2f1d5f2e9 100644
--- a/app/src/protyle/preview/index.ts
+++ b/app/src/protyle/preview/index.ts
@@ -99,7 +99,7 @@ export class Preview {
openBy(linkAddress, "folder");
} else if (event.shiftKey) {
openBy(linkAddress, "app");
- } else if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname((linkAddress.split("?page")[0])))) {
+ } else if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname((linkAddress).split("?")[0]))) {
openAsset(protyle.app, linkAddress.split("?page")[0], parseInt(getSearch("page", linkAddress)));
}
/// #endif
diff --git a/app/src/window/openNewWindow.ts b/app/src/window/openNewWindow.ts
index 2ed26b79f..a4b1517e2 100644
--- a/app/src/window/openNewWindow.ts
+++ b/app/src/window/openNewWindow.ts
@@ -74,7 +74,7 @@ export const openNewWindowById = async (id: string | string[], options: windowOp
export const openAssetNewWindow = (assetPath: string, options: windowOptions = {}) => {
/// #if !BROWSER
- const suffix = pathPosix().extname(assetPath.split("?page")[0]);
+ const suffix = pathPosix().extname(assetPath).split("?")[0];
if (Constants.SIYUAN_ASSETS_EXTS.includes(suffix)) {
let docIcon = "iconPDF";
if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) {