osborn 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -300,14 +300,6 @@ function startApiServer(workingDir, port) {
|
|
|
300
300
|
// GET /sessions/export — stream a gzipped tar of ~/.claude/projects/ to the client
|
|
301
301
|
// Optional ?workDir= query param: if present, export only that project's slug folder.
|
|
302
302
|
if (req.method === 'GET' && url.pathname === '/sessions/export') {
|
|
303
|
-
if (syncToken) {
|
|
304
|
-
const authHeader = req.headers['authorization'] ?? '';
|
|
305
|
-
if (authHeader !== `Bearer ${syncToken}`) {
|
|
306
|
-
res.writeHead(401, { 'Content-Type': 'application/json' });
|
|
307
|
-
res.end(JSON.stringify({ error: 'Unauthorized' }));
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
303
|
const projectsDir = join(homedir(), '.claude', 'projects');
|
|
312
304
|
const workDir = url.searchParams.get('workDir');
|
|
313
305
|
if (workDir) {
|
|
@@ -323,7 +315,8 @@ function startApiServer(workingDir, port) {
|
|
|
323
315
|
'Content-Disposition': `attachment; filename="claude-sessions-${slug}.tar.gz"`,
|
|
324
316
|
'Access-Control-Allow-Origin': '*',
|
|
325
317
|
});
|
|
326
|
-
|
|
318
|
+
// Use '--' to prevent tar from interpreting the leading-hyphen slug as flags
|
|
319
|
+
const tar = spawn('tar', ['-czf', '-', '-C', projectsDir, '--', slug]);
|
|
327
320
|
tar.stdout.pipe(res);
|
|
328
321
|
tar.stderr.on('data', (d) => console.error('[export]', d.toString()));
|
|
329
322
|
tar.on('close', (code) => { if (code !== 0)
|