diff --git a/src/auto-reply/reply/commands-export-session.ts b/src/auto-reply/reply/commands-export-session.ts index 57d49a8d7..eb2f7e3a9 100644 --- a/src/auto-reply/reply/commands-export-session.ts +++ b/src/auto-reply/reply/commands-export-session.ts @@ -24,6 +24,7 @@ import { import { loadSessionStore } from "../../config/sessions/store.js"; import { getRemoteSkillEligibility } from "../../infra/skills-remote.js"; import { buildTtsSystemPromptHint } from "../../tts/tts.js"; +import { resolveUserPath } from "../../utils.js"; // Export HTML templates are bundled with this module const EXPORT_HTML_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "export-html"); @@ -290,7 +291,7 @@ export async function buildExportSessionReply(params: HandleCommandsParams): Pro const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19); const defaultFileName = `openclaw-session-${entry.sessionId.slice(0, 8)}-${timestamp}.html`; const outputPath = args.outputPath - ? path.resolve(args.outputPath.startsWith("~") ? args.outputPath.replace("~", process.env.HOME ?? "") : args.outputPath) + ? resolveUserPath(args.outputPath) : path.join(params.workspaceDir, defaultFileName); // Ensure directory exists