修复中文路径URL编码问题 (#100)
- 在InitCommand中添加decodeURIComponent()处理中文路径 - 解决MCP传入URL编码路径导致验证失败的问题 - 支持类似 /home/azu/%E6%A1%8C%E9%9D%A2/PromptX 的编码路径 Co-authored-by: Cen-Yaozu <azu@example.com>
This commit is contained in:
@ -45,8 +45,9 @@ class InitCommand extends BasePouchCommand {
|
||||
let projectPath
|
||||
|
||||
if (workingDirectory) {
|
||||
// AI提供了工作目录,使用AI提供的路径
|
||||
projectPath = path.resolve(workingDirectory)
|
||||
// AI提供了工作目录,先解码中文路径,然后使用
|
||||
const decodedWorkingDirectory = decodeURIComponent(workingDirectory)
|
||||
projectPath = path.resolve(decodedWorkingDirectory)
|
||||
|
||||
// 验证AI提供的路径是否有效
|
||||
if (!await this.currentProjectManager.validateProjectPath(projectPath)) {
|
||||
@ -153,7 +154,7 @@ ${registryStats.message}
|
||||
if (registryData.size === 0) {
|
||||
return {
|
||||
message: `✅ 项目资源目录已创建,注册表已初始化
|
||||
📂 目录: ${path.relative(process.cwd(), domainDir)}
|
||||
📂 目录: ${path.relative(process.cwd(), resourceDir)}
|
||||
💾 注册表: ${path.relative(process.cwd(), registryPath)}
|
||||
💡 现在可以在 domain 目录下创建角色资源了`,
|
||||
totalResources: 0
|
||||
|
||||
Reference in New Issue
Block a user