Skip to content

Commit f2b789f

Browse files
committed
fix: unexpected post mapping confirmation
1 parent 735616c commit f2b789f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/cmd/post-list/open-post-in-vscode.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function buildLocalPostFileUri(post: Post, includePostId = false):
3737
}
3838

3939
export async function openPostInVscode(postId: number, forceUpdateLocalPostFile = false): Promise<Uri | false> {
40-
let mappedPostFilePath = PostFileMapManager.getFilePath(postId)
40+
const mappedPostFilePath = PostFileMapManager.getFilePath(postId)
4141

4242
const isFileExist = mappedPostFilePath !== undefined && (await fsUtil.exists(mappedPostFilePath))
4343
if (mappedPostFilePath !== undefined && isFileExist && !forceUpdateLocalPostFile) {
@@ -46,10 +46,8 @@ export async function openPostInVscode(postId: number, forceUpdateLocalPostFile
4646
}
4747

4848
// 本地文件已经被删除了, 确保重新生成博文与本地文件的关联
49-
if (mappedPostFilePath !== undefined && !isFileExist) {
50-
await PostFileMapManager.updateOrCreate(postId, '')
51-
mappedPostFilePath = undefined
52-
}
49+
if (mappedPostFilePath !== undefined && !isFileExist)
50+
await PostFileMapManager.updateOrCreate(postId, mappedPostFilePath)
5351

5452
const { post } = await PostService.getPostEditDto(postId)
5553

0 commit comments

Comments
 (0)