dsh-config-sync-plugin 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.4.06",
3
+ "version": "0.4.07",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
@@ -248,7 +248,10 @@ function Get-AppRootLeaf([string]$appRoot) {
248
248
  function Get-AppRootPattern([string]$appRoot) {
249
249
  $leaf = Get-AppRootLeaf $appRoot
250
250
  # 匹配 [盘符]:[\...\]<末级目录名>,含 JSON 双反斜杠写法;不匹配 <名字>-xxx 这类更长的目录
251
- return ('(?i)(?<![A-Za-z0-9_])[A-Z]:[\\/]+(?:[^\s"''`,;()\[\]]*[\\/]+)?' + [regex]::Escape($leaf) + '(?![\w-])(?:[\\/]+)?')
251
+ # 关键修正:排除反斜杠边界,避免吞掉 JSON 里的 \"
252
+ # (?<![A-Za-z0-9_\]) 排除前置反斜杠;(?![\w-\]) 排除后置反斜杠
253
+ # [^\s"',;()\[\]\\] 排除路径字符类里的反斜杠
254
+ return ('(?i)(?<![A-Za-z0-9_\\])[A-Z]:[\\/]+(?:[^\s"''`,;()\[\]\\]*[\\/]+)?' + [regex]::Escape($leaf) + '(?![\w-\\])(?:[\\/]+)?')
252
255
  }
253
256
 
254
257
  function Get-AppRootFwd([string]$appRoot) {