Skip to content

fix(electron-demo): 修复 Vault 保存路径边界校验#124

Open
hamroun1 wants to merge 1 commit into
floatboatai:mainfrom
hamroun1:fix/vault-save-path-boundary
Open

fix(electron-demo): 修复 Vault 保存路径边界校验#124
hamroun1 wants to merge 1 commit into
floatboatai:mainfrom
hamroun1:fix/vault-save-path-boundary

Conversation

@hamroun1

@hamroun1 hamroun1 commented Jul 3, 2026

Copy link
Copy Markdown

概述

修复了 Vault 保存路径校验逻辑,避免具有相同前缀的兄弟目录被错误识别为 Vault 内部路径。

修改内容

  • 新增 isPathInside 路径校验工具函数。
  • 使用 isPathInside 替换原来的 startsWith 路径判断。
  • 新增单元测试,覆盖以下场景:
    • 相同路径
    • 子目录路径
    • 尾部斜杠
    • Windows 路径分隔符
    • /vault/vault2 前缀冲突
    • 根目录路径

验证

已通过以下验证:

  • pnpm vitest run apps/electron-demo/test/path-utils.test.ts
  • pnpm typecheck

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


dell seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants