File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ export async function saveLocalPost(localPost: LocalPost) {
7878 const extracted = await extractImg ( text , fileDir , autoExtractImgSrc )
7979 if ( extracted !== undefined ) {
8080 postToSave . postBody = extracted
81+ if ( isEmptyBody ( text , '(发生于提取图片后' ) ) return false
8182
8283 if ( MarkdownCfg . getApplyAutoExtractImgToLocal ( ) ) {
8384 const doc = window . visibleTextEditors . find ( x => x . document . uri . fsPath === localPost . filePath )
@@ -97,9 +98,9 @@ export async function saveLocalPost(localPost: LocalPost) {
9798 } )
9899}
99100
100- function isEmptyBody ( body : string ) {
101+ function isEmptyBody ( body : string , tip : string = '' ) {
101102 if ( body === '' ) {
102- void Alert . warn ( '博文内容不能为空' )
103+ void Alert . warn ( '博文内容不能为空' + tip )
103104 return true
104105 }
105106
Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ export namespace PostService {
123123
124124 export async function update ( post : Post ) {
125125 if ( MarkdownCfg . isIgnoreYfmWhenUploadPost ( ) ) post . postBody = rmYfm ( post . postBody )
126+
127+ if ( post . postBody === '' ) void Alert . warn ( '博文内容不能为空(发生于 http post 请求之前)' )
128+
126129 const body = JSON . stringify ( post )
127130 const req = await getAuthedPostReq ( )
128131 const resp = await req . update ( body )
You can’t perform that action at this time.
0 commit comments