Skip to content

Commit

Permalink
fix: 提供更友好的PicGO错误提示
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Jan 10, 2023
1 parent b26b76c commit dc779ed
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -20,7 +20,8 @@
"extChromeWin": "pwsh scripts/ext.ps1",
"extChromeDev": "bash scripts/extDev.sh",
"extFirefox": "bash scripts/extFV2.sh",
"newVersion": "cd scripts && python3 version.py 0.6.1 && cd ../"
"newVersion": "cd scripts && python3 version.py 0.6.1 && cd ../",
"dcfg": "bash scripts/devWidgetConfig.sh"
},
"dependencies": {
"@element-plus/icons-vue": "^2.0.9",
Expand Down
30 changes: 30 additions & 0 deletions scripts/devWidgetConfig.sh
@@ -0,0 +1,30 @@
#
# Copyright (c) 2023, Terwer . All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Terwer designates this
# particular file as subject to the "Classpath" exception as provided
# by Terwer in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
# or visit www.terwer.space if you need additional information or have any
# questions.
#

# 一些开发环境的额外配置

# 拷贝可用的PicGO配置
cp -r ./public/lib/picgo/picgo.cfg.dev.json ../my-note-docker/workspace/SiYuan/data/widgets/sy-post-publisher/lib/picgo/picgo.cfg.json
echo "dev config copy finished."
9 changes: 8 additions & 1 deletion utils/platform/picgo/picgoPostApi.ts
Expand Up @@ -227,10 +227,17 @@ export class PicgoPostApi {
// 处理后续
if (imageJsonObj && imageJsonObj.length > 0) {
const img = imageJsonObj[0]
if (!img || !img.imgUrl || isEmptyString(img.imgUrl)) {
throw new Error(
"图片上传失败,可能原因:PicGO配置错误或者该平台不支持图片覆盖,请检查配置或者尝试上传新图片。请打开picgo.log查看更多信息"
)
}
const newImageItem = new ImageItem(imageItem.originUrl, img.imgUrl, false)
fileMap[newImageItem.hash] = newImageItem
} else {
throw new Error("图片上传失败,请打开picgo.log查看更多信息")
throw new Error(
"图片上传失败,可能原因:PicGO配置错误,请检查配置。请打开picgo.log查看更多信息"
)
}

this.logger.warn("newFileMap=>", fileMap)
Expand Down

0 comments on commit dc779ed

Please sign in to comment.