mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-12 04:01:20 +00:00
fix(api): close coverage edges in media-references route
This commit is contained in:
@@ -126,20 +126,16 @@ export async function serveMediaReference(
|
||||
}
|
||||
if (registry === undefined) return new Response('file serving is unavailable', { status: 403 })
|
||||
let canonical: string
|
||||
let info
|
||||
try {
|
||||
canonical = await realpath(path)
|
||||
info = await stat(canonical)
|
||||
} catch {
|
||||
return new Response('not found', { status: 404 })
|
||||
}
|
||||
const insideWorkspace = registry.list().some(root =>
|
||||
canonical === root.path || canonical.startsWith(root.path + sep))
|
||||
if (!insideWorkspace) return new Response('outside workspace roots', { status: 403 })
|
||||
let info
|
||||
try {
|
||||
info = await stat(canonical)
|
||||
} catch {
|
||||
return new Response('not found', { status: 404 })
|
||||
}
|
||||
if (!info.isFile()) return new Response('not a regular file', { status: 403 })
|
||||
const mediaType = mediaTypeForPath(canonical)
|
||||
if (mediaType === undefined) {
|
||||
|
||||
Reference in New Issue
Block a user