fix: 修复编辑公告保存失败 — 图片上传逻辑

- uploadImageIfNeeded 增加 notif_ 前缀判断
- 编辑保留原图时不再尝试上传本地文件
This commit is contained in:
2026-06-08 11:04:33 +08:00
parent 5124b390a7
commit 8b5589192d

View File

@@ -299,8 +299,8 @@ function insertFormat(prefix: string, suffix: string) {
/** 上传图片 */
async function uploadImageIfNeeded(imageUrl: string): Promise<string> {
if (!imageUrl) return ''
// 如果已经是完整 URL 或 blob URL直接返回
if (imageUrl.startsWith('http') || imageUrl.startsWith('blob:')) {
// 已经是服务器文件名notif_ 开头)、完整 URL 或 blob URL直接返回
if (imageUrl.startsWith('notif_') || imageUrl.startsWith('http') || imageUrl.startsWith('blob:')) {
return imageUrl
}
// 临时路径需要上传