fix: 修复编辑公告保存失败 — 图片上传逻辑
- uploadImageIfNeeded 增加 notif_ 前缀判断 - 编辑保留原图时不再尝试上传本地文件
This commit is contained in:
@@ -299,8 +299,8 @@ function insertFormat(prefix: string, suffix: string) {
|
|||||||
/** 上传图片 */
|
/** 上传图片 */
|
||||||
async function uploadImageIfNeeded(imageUrl: string): Promise<string> {
|
async function uploadImageIfNeeded(imageUrl: string): Promise<string> {
|
||||||
if (!imageUrl) return ''
|
if (!imageUrl) return ''
|
||||||
// 如果已经是完整 URL 或 blob URL,直接返回
|
// 已经是服务器文件名(notif_ 开头)、完整 URL 或 blob URL,直接返回
|
||||||
if (imageUrl.startsWith('http') || imageUrl.startsWith('blob:')) {
|
if (imageUrl.startsWith('notif_') || imageUrl.startsWith('http') || imageUrl.startsWith('blob:')) {
|
||||||
return imageUrl
|
return imageUrl
|
||||||
}
|
}
|
||||||
// 临时路径需要上传
|
// 临时路径需要上传
|
||||||
|
|||||||
Reference in New Issue
Block a user