mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix(artifacts): render artifacts from the checked path and serve raw files once
- show_artifact returns the validated path as tool metadata; the chat card renders from it and maps repo paths with getWorkspaceFilePath, so local repos and moved sessions load the right file - serve .htm as text/html - raw file route stats and reads once and adds ETag/Last-Modified with 304 - reuse isPathWithinRoot from utils/fs-safe - move readShowArtifactCall to frontend/src/lib/artifactTool
This commit is contained in:
1 parent
f7b2ffb865
commit
5e2452172c
26 files changed
+489
-58
No files matched your search
@@ -26,6 +26,11 @@ export function canonicalPathSync(target: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
export function isPathWithinRoot(root: string, target: string): boolean {
|
||||
const relative = path.relative(path.resolve(root), path.resolve(target))
|
||||
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative))
|
||||
}
|
||||
|
||||
export async function writeFileAtomic(filePath: string, content: string | Buffer, options: { mode?: number } = {}): Promise<void> {
|
||||
const dir = path.dirname(filePath)
|
||||
await mkdirSafe(dir)
|
||||
|
||||
Reference in new issue
Block a user