From cc3d0d8494ba96b1e313c9255e0650f7b985fe4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=8B=87=E7=A5=A5?= <237899745@qq.com> Date: Thu, 13 Nov 2025 19:49:59 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=AF=94=E8=BE=83=E4=BF=AE=E5=A4=8D=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复isPathWithinShare函数中路径前缀斜杠不一致导致的匹配失败问题 --- fix_share_path.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 fix_share_path.sh diff --git a/fix_share_path.sh b/fix_share_path.sh new file mode 100644 index 0000000..113acbe --- /dev/null +++ b/fix_share_path.sh @@ -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"