From d4de553a09ea6b07a5f7e2c4acf3affc47e09c5d Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 20 Aug 2022 10:43:19 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/5681 --- app/pnpm-lock.yaml | 4 ++-- app/src/editor/util.ts | 17 +++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index a743c6c26..21f1e720c 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -1906,10 +1906,10 @@ packages: resolution: {integrity: sha512-mi4DG3m32cMJ5CtO9iYk41gBvGWLzJjQsaQgGOd4ZhmIuKyj8M/0rT1g0s/0qD4Tw8jsa//NXMXCC7vpGIfkTg==} engines: {node: '>=14.0.0'} dependencies: - 7zip-bin: 5.1.1 '@develar/schema-utils': 2.6.5 '@electron/universal': 1.2.1 '@malept/flatpak-bundler': 0.4.0 + 7zip-bin: 5.1.1 async-exit-hook: 2.0.1 bluebird-lst: 1.0.9 builder-util: 23.3.0 @@ -2193,9 +2193,9 @@ packages: /builder-util/23.3.0: resolution: {integrity: sha512-m7RRd21N2yrnuGFd+ZqOY0ryeqWmBslDKmGDVz0wETqoEEqpiJsF3CGlsb6MRN2EQKDubvE5e+lBf8ATt06fnA==} dependencies: - 7zip-bin: 5.1.1 '@types/debug': 4.1.7 '@types/fs-extra': 9.0.13 + 7zip-bin: 5.1.1 app-builder-bin: 4.0.0 bluebird-lst: 1.0.9 builder-util-runtime: 9.0.3 diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 686a97bde..c0024adbb 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -436,7 +436,6 @@ export const updateBacklinkGraph = (models: IModels, protyle: IProtyle) => { export const openBy = (url: string, type: "folder" | "app") => { /// #if !BROWSER - let address; if (url.startsWith("assets/")) { fetchPost("/api/asset/resolveAssetPath", {path: url.replace(/\.pdf\?page=\d{1,}$/, ".pdf")}, (response) => { if (type === "app") { @@ -446,16 +445,14 @@ export const openBy = (url: string, type: "folder" | "app") => { } }); return; - } else { - address = url.replace("file:///", "") - .replace("file://\\", "") - .replace("file://", ""); - if ("windows" === window.siyuan.config.system.os) { - // `file://` 协议兼容 Window 平台使用 `/` 作为目录分割线 https://github.com/siyuan-note/siyuan/issues/5681 - address = address.replace("/", "\\"); - } } - + let address = ""; + if ("windows" === window.siyuan.config.system.os) { + // `file://` 协议兼容 Window 平台使用 `/` 作为目录分割线 https://github.com/siyuan-note/siyuan/issues/5681 + address = url.replace("file:///", "").replace("file://\\", "").replace("file://", "").replace("/", "\\"); + } else { + address = url.replace("file://", ""); + } if (type === "app") { shell.openPath(address); } else if (type === "folder") {