Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/sim/app/api/files/export/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,20 @@ export const GET = withRouteHandler(
MAX_EMBEDDED_IMAGES
)

logger.info('Exporting markdown with embedded images', { id, imageCount: imageIds.length })
logger.info('Exporting markdown', { id, imageCount: imageIds.length })

if (imageIds.length === 0) {
const mdName = safeFilename(record.originalName)
const mdBytes = Buffer.from(mdContent, 'utf-8')
return new NextResponse(new Uint8Array(mdBytes), {
status: 200,
headers: {
'Content-Type': 'text/markdown; charset=utf-8',
'Content-Disposition': `attachment; filename="${mdName}"`,
'Content-Length': String(mdBytes.length),
},
})
}

const fetchResults = await Promise.allSettled(
imageIds.map(async (imageId) => {
Expand Down
Loading