🐛 修复文件名包含反引号时变成undefined的问题

- 从sanitizeInput正则表达式中移除反引号
- 之前map中没有反引号映射导致返回undefined

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-30 15:27:59 +08:00
parent 0e6230612c
commit d3fcb159f9

View File

@@ -198,9 +198,9 @@ app.use((req, res, next) => {
function sanitizeInput(str) {
if (typeof str !== 'string') return str;
// 1. 基础HTML实体转义不包括 / 因为是路径分隔符)
// 1. 基础HTML实体转义不包括 / 因为是路径分隔符,不包括 ` 因为是合法文件名字符
let sanitized = str
.replace(/[&<>"'`]/g, (char) => {
.replace(/[&<>"']/g, (char) => {
const map = {
'&': '&amp;',
'<': '&lt;',