🐛 加强文件名解码的空值处理

- 后端decodeHtmlEntities添加空字符串默认值
- 前端decodeHtmlEntities非字符串时返回空字符串
- getFileDisplayName增强类型检查

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-30 14:56:26 +08:00
parent dd97328b2f
commit 0e6230612c
2 changed files with 6 additions and 4 deletions

View File

@@ -2017,7 +2017,7 @@ handleDragLeave(e) {
// HTML实体解码前端兜底防止已实体化的文件名显示乱码
decodeHtmlEntities(str) {
if (typeof str !== 'string') return str;
if (typeof str !== 'string') return '';
const entityMap = {
amp: '&',
lt: '<',
@@ -2052,9 +2052,11 @@ handleDragLeave(e) {
getFileDisplayName(file) {
if (!file) return '';
const base = file.displayName || file.name || '';
const base = (typeof file.displayName === 'string' && file.displayName !== '')
? file.displayName
: (typeof file.name === 'string' ? file.name : '');
const decoded = this.decodeHtmlEntities(base);
return decoded || base;
return decoded || base || '';
},
openShare(url) {