- miniprogram: reading-records、imageUrl/mpNavigate、多页资料与 VIP 展示调整 - soul-admin: Users/Settings/UserDetailModal、dist 构建产物更新 - soul-api: user/vip/referral/ckb/db、MBTI 头像管理、user_rule_completion、迁移 SQL - .cursor: karuo-party 与飞书文档;.gitignore 忽略 .tmp_skill_bundle Made-with: Cursor
15 lines
468 B
JavaScript
15 lines
468 B
JavaScript
/**
|
|
* 小程序 <image src> 合法判断:避免 undefined 字符串、相对脏值触发「illegal src」
|
|
*/
|
|
function isSafeImageSrc(u) {
|
|
if (u == null) return false
|
|
const s = String(u).trim()
|
|
if (!s || s === 'undefined' || s === 'null') return false
|
|
if (/^https?:\/\//i.test(s)) return true
|
|
if (s.startsWith('wxfile://') || s.startsWith('cloud://')) return true
|
|
if (s.startsWith('/')) return true
|
|
return false
|
|
}
|
|
|
|
module.exports = { isSafeImageSrc }
|