fix: protect download bytes and recover local API errors

This commit is contained in:
Evandro Fonseca Junior committed 2026-09-30 17:08:35 -03:00
1 parent 039d25f084
commit e8a252ecde
9 files changed
+203 -184

No files matched your search

+2 -2
View File
@@ -12,6 +12,7 @@ import {
isRequestBodySizeAllowed,
getLocalNetworkUrls,
validateSttBaseUrl,
sendInternalServerError,
} from './piagentui-server-core.js'
import {
createPiAgentUiSettingsStore,
@@ -2075,8 +2076,7 @@ export default function (pi: ExtensionAPI) {
const urlPath = req.url || ''
if (urlPath.startsWith('/api/') || urlPath.startsWith('/global/')) {
handleApiRequest(req, res).catch(() => {
res.writeHead(500, { 'Content-Type': 'application/json' })
res.end(JSON.stringify({ error: 'Internal Server Error' }))
sendInternalServerError(res)
})
} else {
handleStaticFile(req, res, urlPath)