Skip to content

LINUX部署下 左边会话列表删除不掉的情况 #41

Description

@IshtarCC

硬编码为一段 Windows 命令
DELETE /api/projects/:name/sessions/:id(server.js 第 1214 行)

修复:

app.delete('/api/projects/:name/sessions/:id', async (req, res) => {
try {
const fp = path.join(os.homedir(), '.claude', 'projects', req.params.name, req.params.id + '.jsonl');
await fs.access(fp);
const isWin = process.platform === 'win32';
if (isWin) {
// Windows: 移到系统回收站(适用于 Windows 版 yxcode)
const cmd = powershell.exe -Command "Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile('${fp.replace(/'/g, "''")}', 'OnlyErrorDialogs', 'SendToRecycleBin')";
await execAsync(cmd);
} else {
// Linux/macOS: 直接删除 .jsonl(同时清理同名的 .jsonl.tmp 遗留)
await fs.unlink(fp).catch(() => {});
await fs.unlink(fp + '.tmp').catch(() => {});
}
res.json({ success: true });
} catch (e) { res.status(500).json({ error: e.message }); }
});

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions