File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import { revealPostListItem } from '@/service/post/post-list-view'
9
9
import { PostTreeItem } from '@/tree-view/model/post-tree-item'
10
10
import { MarkdownCfg } from '@/ctx/cfg/markdown'
11
11
import { fsUtil } from '@/infra/fs/fsUtil'
12
- import { WorkspaceCfg } from '@/ctx/cfg/workspace'
13
12
14
13
export async function postPull ( input : Post | PostTreeItem | Uri | undefined | null , showConfirm = true , mute = false ) {
15
14
const ctxList : CmdCtx [ ] = [ ]
@@ -18,11 +17,7 @@ export async function postPull(input: Post | PostTreeItem | Uri | undefined | nu
18
17
if ( parsePostInput ( input ) && input . id > 0 ) {
19
18
const post = input
20
19
const path = PostFileMapManager . getFilePath ( post . id )
21
- if (
22
- path === undefined ||
23
- ! ( await fsUtil . exists ( path ) ) ||
24
- path . indexOf ( WorkspaceCfg . getWorkspaceUri ( ) . fsPath ) < 0
25
- ) {
20
+ if ( path === undefined || ! ( await fsUtil . exists ( path ) ) ) {
26
21
isFreshPull = true
27
22
const uri = buildLocalPostFileUri ( post , false )
28
23
await workspace . fs . writeFile ( uri , Buffer . from ( post . postBody ) )
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { postCategoryDataProvider } from '@/tree-view/provider/post-category-tre
2
2
import { postDataProvider } from '@/tree-view/provider/post-data-provider'
3
3
import { LocalState } from '@/ctx/local-state'
4
4
import { Uri } from 'vscode'
5
+ import { WorkspaceCfg } from '@/ctx/cfg/workspace'
5
6
6
7
const validatePostFileMap = ( map : PostFileMap ) => map [ 0 ] >= 0 && map [ 1 ] !== ''
7
8
@@ -69,6 +70,7 @@ export namespace PostFileMapManager {
69
70
if ( map === undefined ) return
70
71
const path = map [ 1 ]
71
72
if ( path === '' ) return
73
+ if ( path . indexOf ( WorkspaceCfg . getWorkspaceUri ( ) . path ) < 0 ) return
72
74
return path . startsWith ( '/' ) ? Uri . parse ( path ) . fsPath : path
73
75
}
74
76
You can’t perform that action at this time.
0 commit comments