mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-03-05 22:17:42 +00:00
fix(claude): correct project encoded path (#451)
fix wrong regex replace of Claude project path related #447, reopen due to forced-push to reproduce error steps, let's try Create a folder with @ in name like @test Add this folder as new project in CloudCLI Choose Claude tool in new Session Star by typing sth 'hi' In the dev tools, you will see errors ajax response said that session does not find for 'some-session-id' The main problem is current encode path doesn't encode '@' to '-' as Claude did I reversed code Claude-SDK, file 'cli.js' to find exactly regex (using in PR) that used to encode path under ~/.claude/projects/<encoded-project-name-path/<session-id>.jsonl
This commit is contained in:
@@ -1218,7 +1218,7 @@ function handleShellConnection(ws) {
|
|||||||
if (hasSession && sessionId) {
|
if (hasSession && sessionId) {
|
||||||
try {
|
try {
|
||||||
// Gemini CLI enforces its own native session IDs, unlike other agents that accept arbitrary string names.
|
// Gemini CLI enforces its own native session IDs, unlike other agents that accept arbitrary string names.
|
||||||
// The UI only knows about its internal generated `sessionId` (e.g. gemini_1234).
|
// The UI only knows about its internal generated `sessionId` (e.g. gemini_1234).
|
||||||
// We must fetch the mapping from the backend session manager to pass the native `cliSessionId` to the shell.
|
// We must fetch the mapping from the backend session manager to pass the native `cliSessionId` to the shell.
|
||||||
const sess = sessionManager.getSession(sessionId);
|
const sess = sessionManager.getSession(sessionId);
|
||||||
if (sess && sess.cliSessionId) {
|
if (sess && sess.cliSessionId) {
|
||||||
@@ -1791,8 +1791,8 @@ app.get('/api/projects/:projectName/sessions/:sessionId/token-usage', authentica
|
|||||||
|
|
||||||
// Construct the JSONL file path
|
// Construct the JSONL file path
|
||||||
// Claude stores session files in ~/.claude/projects/[encoded-project-path]/[session-id].jsonl
|
// Claude stores session files in ~/.claude/projects/[encoded-project-path]/[session-id].jsonl
|
||||||
// The encoding replaces /, spaces, ~, and _ with -
|
// The encoding replaces any non-alphanumeric character (except -) with -
|
||||||
const encodedPath = projectPath.replace(/[\\/:\s~_]/g, '-');
|
const encodedPath = projectPath.replace(/[^a-zA-Z0-9-]/g, '-');
|
||||||
const projectDir = path.join(homeDir, '.claude', 'projects', encodedPath);
|
const projectDir = path.join(homeDir, '.claude', 'projects', encodedPath);
|
||||||
|
|
||||||
const jsonlPath = path.join(projectDir, `${safeSessionId}.jsonl`);
|
const jsonlPath = path.join(projectDir, `${safeSessionId}.jsonl`);
|
||||||
|
|||||||
Reference in New Issue
Block a user