add: 添加分享路径比较修复脚本
修复isPathWithinShare函数中路径前缀斜杠不一致导致的匹配失败问题
This commit is contained in:
21
fix_share_path.sh
Normal file
21
fix_share_path.sh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/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"
|
||||||
Reference in New Issue
Block a user