File tree Expand file tree Collapse file tree
apps/sim/app/api/files/export/[id] Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,15 +28,13 @@ function isMarkdown(originalName: string, contentType: string): boolean {
2828 return MARKDOWN_EXTENSIONS . has ( ext )
2929}
3030
31- /** Strip characters that would break Content-Disposition header or zip entry paths. */
3231function safeFilename ( name : string ) : string {
3332 return path
3433 . basename ( name )
3534 . replace ( / [ " \\ ] / g, '_' )
3635 . replace ( / [ \r \n \t ] / g, '' )
3736}
3837
39- /** Deduplicate asset filename by appending the first 8 chars of its UUID when a collision exists. */
4038function deduplicatedFilename ( preferred : string , existing : Set < string > , imageId : string ) : string {
4139 if ( ! existing . has ( preferred ) ) return preferred
4240 const ext = path . extname ( preferred )
@@ -87,8 +85,6 @@ export const GET = withRouteHandler(
8785
8886 logger . info ( 'Exporting markdown with embedded images' , { id, imageCount : imageIds . length } )
8987
90- // Fetch all images in parallel, then deduplicate filenames serially to avoid
91- // a race where two concurrent callbacks both pass the "not yet seen" check.
9288 const fetchResults = await Promise . allSettled (
9389 imageIds . map ( async ( imageId ) => {
9490 const imgRecord = await getFileMetadataById ( imageId )
You can’t perform that action at this time.
0 commit comments