fix(memory-feedback): worksheet prints only a shell-safe repo path
This commit is contained in:
1 parent
027e5b3c21
commit
9ec5617725
3 files changed
+21
-3
No files matched your search
@@ -5,7 +5,8 @@ import * as os from 'node:os'
|
||||
import * as path from 'node:path'
|
||||
import { slugOf } from './transcripts.ts'
|
||||
import {
|
||||
apply, checkDir, population, readLogs, sample, storeFile, worksheet,
|
||||
apply, checkDir, population, readLogs, safePath, sample, storeFile,
|
||||
worksheet,
|
||||
type Paths,
|
||||
} from './reader.ts'
|
||||
|
||||
@@ -173,3 +174,10 @@ test('R9: sample picks entry lines of the draft', () => {
|
||||
draft(work, '1\tBDR-001\trelevant\n1\t-\tchecked\n')
|
||||
expect(sample(work, 5)).toEqual(['1\tBDR-001\trelevant'])
|
||||
})
|
||||
|
||||
test('safePath keeps plain paths and withholds shell-active ones', () => {
|
||||
const w = 'path withheld: unsafe characters'
|
||||
expect(safePath('/home/u/repo.x')).toBe('/home/u/repo.x')
|
||||
for (const bad of ['/tmp/$(id)', '/tmp/`id`', "/tmp/a'b", '/a/../b'])
|
||||
expect(safePath(bad)).toBe(w)
|
||||
})
|
||||
Reference in new issue
Block a user