MCPcopy Index your code
hub / github.com/simstudioai/sim / handleCloudProxyPublic

Function handleCloudProxyPublic

apps/sim/app/api/files/serve/[...path]/route.ts:287–321  ·  view source on GitHub ↗
(
  cloudKey: string,
  context: StorageContext
)

Source from the content-addressed store, hash-verified

285}
286
287async function handleCloudProxyPublic(
288 cloudKey: string,
289 context: StorageContext
290): Promise<NextResponse> {
291 try {
292 let fileBuffer: Buffer
293
294 if (context === 'copilot') {
295 fileBuffer = await CopilotFiles.downloadCopilotFile(cloudKey)
296 } else {
297 fileBuffer = await downloadFile({
298 key: cloudKey,
299 context,
300 })
301 }
302
303 const filename = cloudKey.split('/').pop() || 'download'
304 const contentType = getContentType(filename)
305
306 logger.info('Public cloud file served', {
307 key: cloudKey,
308 size: fileBuffer.length,
309 context,
310 })
311
312 return createFileResponse({
313 buffer: fileBuffer,
314 contentType,
315 filename,
316 })
317 } catch (error) {
318 logger.error('Error serving public cloud file:', error)
319 throw error
320 }
321}
322
323async function handleLocalFilePublic(filename: string): Promise<NextResponse> {
324 try {

Callers 1

route.tsFile · 0.85

Calls 5

downloadFileFunction · 0.90
getContentTypeFunction · 0.90
createFileResponseFunction · 0.90
infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected