From 98f19ae66dccf07771fbd1470151a58528ad9193 Mon Sep 17 00:00:00 2001 From: dudu Date: Mon, 13 Nov 2023 19:03:31 +0800 Subject: [PATCH] fix: file path check for post-pull --- src/cmd/post-list/post-pull.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cmd/post-list/post-pull.ts b/src/cmd/post-list/post-pull.ts index a4fd9f9c..79a10fc4 100644 --- a/src/cmd/post-list/post-pull.ts +++ b/src/cmd/post-list/post-pull.ts @@ -9,6 +9,7 @@ import { revealPostListItem } from '@/service/post/post-list-view' import { PostTreeItem } from '@/tree-view/model/post-tree-item' import { MarkdownCfg } from '@/ctx/cfg/markdown' import { fsUtil } from '@/infra/fs/fsUtil' +import { WorkspaceCfg } from '@/ctx/cfg/workspace' export async function postPull(input: Post | PostTreeItem | Uri | undefined | null, showConfirm = true, mute = false) { const ctxList: CmdCtx[] = [] @@ -17,7 +18,11 @@ export async function postPull(input: Post | PostTreeItem | Uri | undefined | nu if (parsePostInput(input) && input.id > 0) { const post = input const path = PostFileMapManager.getFilePath(post.id) - if (path === undefined || !(await fsUtil.exists(path))) { + if ( + path === undefined || + !(await fsUtil.exists(path)) || + path.indexOf(WorkspaceCfg.getWorkspaceUri().path) < 0 + ) { isFreshPull = true const uri = await buildLocalPostFileUri(post, false) await workspace.fs.writeFile(uri, Buffer.from(post.postBody))