22 lines
661 B
Bash
22 lines
661 B
Bash
#!/bin/bash
|
|
# 修复 isPathWithinShare 函数的路径比较逻辑
|
|
# 解决分享路径有无斜杠前缀导致的匹配失败问题
|
|
|
|
cd "$(dirname "$0")/backend"
|
|
|
|
echo "开始修复 server.js..."
|
|
|
|
# 使用sed修复
|
|
sed -i '179s/const normalizedRequest/let normalizedRequest/' server.js
|
|
sed -i '180s/const normalizedShare/let normalizedShare/' server.js
|
|
|
|
# 在第180行后添加路径统一处理
|
|
sed -i "180a\\
|
|
\\
|
|
// 统一移除开头的斜杠进行比较\\
|
|
normalizedRequest = normalizedRequest.replace(/^\\\\\\/+/, '');\\
|
|
normalizedShare = normalizedShare.replace(/^\\\\\\/+/, '');" server.js
|
|
|
|
echo "修复完成!"
|
|
echo "请运行: pm2 restart all"
|