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) {
78
78
const extracted = await extractImg ( text , fileDir , autoExtractImgSrc )
79
79
if ( extracted !== undefined ) {
80
80
postToSave . postBody = extracted
81
+ if ( isEmptyBody ( text , '(发生于提取图片后' ) ) return false
81
82
82
83
if ( MarkdownCfg . getApplyAutoExtractImgToLocal ( ) ) {
83
84
const doc = window . visibleTextEditors . find ( x => x . document . uri . fsPath === localPost . filePath )
@@ -97,9 +98,9 @@ export async function saveLocalPost(localPost: LocalPost) {
97
98
} )
98
99
}
99
100
100
- function isEmptyBody ( body : string ) {
101
+ function isEmptyBody ( body : string , tip : string = '' ) {
101
102
if ( body === '' ) {
102
- void Alert . warn ( '博文内容不能为空' )
103
+ void Alert . warn ( '博文内容不能为空' + tip )
103
104
return true
104
105
}
105
106
Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ export namespace PostService {
123
123
124
124
export async function update ( post : Post ) {
125
125
if ( MarkdownCfg . isIgnoreYfmWhenUploadPost ( ) ) post . postBody = rmYfm ( post . postBody )
126
+
127
+ if ( post . postBody === '' ) void Alert . warn ( '博文内容不能为空(发生于 http post 请求之前)' )
128
+
126
129
const body = JSON . stringify ( post )
127
130
const req = await getAuthedPostReq ( )
128
131
const resp = await req . update ( body )
You can’t perform that action at this time.
0 commit comments