@@ -74,11 +74,12 @@ export async function saveLocalPost(localPost: LocalPost) {
74
74
// TODO: need refactor
75
75
const autoExtractImgSrc = MarkdownCfg . getAutoExtractImgSrc ( )
76
76
const fileDir = dirname ( localPost . filePath )
77
+ postToSave . postBody = text
77
78
if ( autoExtractImgSrc !== undefined ) {
78
79
const extracted = await extractImg ( text , fileDir , autoExtractImgSrc )
79
80
if ( extracted !== undefined ) {
80
81
postToSave . postBody = extracted
81
- if ( isEmptyBody ( text , '(发生于提取图片后' ) ) return false
82
+ if ( isEmptyBody ( postToSave . postBody , '(发生于提取图片后' ) ) return false
82
83
83
84
if ( MarkdownCfg . getApplyAutoExtractImgToLocal ( ) ) {
84
85
const doc = window . visibleTextEditors . find ( x => x . document . uri . fsPath === localPost . filePath )
@@ -89,8 +90,6 @@ export async function saveLocalPost(localPost: LocalPost) {
89
90
}
90
91
}
91
92
}
92
- } else {
93
- postToSave . postBody = text
94
93
}
95
94
96
95
return true
@@ -133,10 +132,12 @@ export async function uploadPost(input?: Post | PostTreeItem | PostEditDto, conf
133
132
const text = await localPost . readAllText ( )
134
133
const autoExtractImgSrc = MarkdownCfg . getAutoExtractImgSrc ( )
135
134
const fileDir = dirname ( localPost . filePath )
135
+ post . postBody = text
136
136
if ( autoExtractImgSrc !== undefined ) {
137
137
const extracted = await extractImg ( text , fileDir , autoExtractImgSrc )
138
138
if ( extracted !== undefined ) {
139
139
post . postBody = extracted
140
+ if ( isEmptyBody ( post . postBody , '(发生于提取图片后' ) ) return false
140
141
141
142
if ( MarkdownCfg . getApplyAutoExtractImgToLocal ( ) ) {
142
143
const doc = window . visibleTextEditors . find ( x => x . document . uri . fsPath === localPost . filePath ) ?. document
@@ -146,8 +147,6 @@ export async function uploadPost(input?: Post | PostTreeItem | PostEditDto, conf
146
147
}
147
148
}
148
149
}
149
- } else {
150
- post . postBody = text
151
150
}
152
151
153
152
if ( isEmptyBody ( post . postBody ) ) return false
0 commit comments