From 16bd66f1f8dd440774de33bec6e2aef70ca6feb1 Mon Sep 17 00:00:00 2001 From: wanna Date: Tue, 12 Aug 2025 09:49:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20move=5Ffiles=20newPath=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AE=A1=E7=AE=97=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts b/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts index 44fc37e95..e5290809d 100644 --- a/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts +++ b/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts @@ -1030,9 +1030,7 @@ export class FileSystemServer { const results = await Promise.all( parsed.data.sources.map(async (source) => { const validSourcePath = await this.validatePath(source) - const validDestPath = await this.validatePath( - path.join(parsed.data.destination, path.basename(source)) - ) + const validDestPath = await this.validatePath(parsed.data.destination) try { await fs.rename(validSourcePath, validDestPath) return `Successfully moved ${source} to ${parsed.data.destination}` From 8a839a053aea1ab75c6958bf0d5aa13610ed26eb Mon Sep 17 00:00:00 2001 From: wanna Date: Tue, 12 Aug 2025 10:39:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20move=5Ffiles=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E5=89=8D=E9=9C=80=E8=A6=81=E5=88=A4=E6=96=ADdest=E6=98=AF?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E8=BF=98=E6=98=AF=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mcpPresenter/inMemoryServers/filesystem.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts b/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts index e5290809d..e500b1cd9 100644 --- a/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts +++ b/src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts @@ -1027,10 +1027,18 @@ export class FileSystemServer { if (!parsed.success) { throw new Error(`Invalid arguments for move_files: ${parsed.error}`) } + const destInfo = await this.getFileStats(parsed.data.destination) const results = await Promise.all( parsed.data.sources.map(async (source) => { const validSourcePath = await this.validatePath(source) - const validDestPath = await this.validatePath(parsed.data.destination) + let validDestPath = '' + if (destInfo.isFile) { + validDestPath = await this.validatePath(parsed.data.destination) + } else { + validDestPath = await this.validatePath( + path.join(parsed.data.destination, path.basename(source)) + ) + } try { await fs.rename(validSourcePath, validDestPath) return `Successfully moved ${source} to ${parsed.data.destination}`