@@ -10,7 +10,8 @@ import sharp from 'sharp'
1010import { encryptSecret } from '@/lib/core/security/encryption'
1111import { getStorageProvider } from '@/lib/uploads/config'
1212import { UPLOAD_DIR_SERVER } from '@/lib/uploads/core/setup.server'
13- import { storeCompiledDoc } from '@/lib/uploads/documents/compiled-store'
13+ import { fileDocumentCacheIdentity , getE2BDocFormat } from '@/lib/uploads/documents/compile'
14+ import { compiledArtifactKey , storeCompiledDoc } from '@/lib/uploads/documents/compiled-store'
1415
1516/** Real public wire/cookie proof; SQL and Redis only seed disposable sharing and OTP fixtures. */
1617const base = new URL ( required ( process . env . PROJECT_FILE_PUBLIC_BASE_URL ) )
@@ -305,17 +306,25 @@ try {
305306 json ( unavailable , 409 ) . error ,
306307 'This document is still being prepared. Please try again shortly.'
307308 )
308- let key : string | undefined
309+ const format = await getE2BDocFormat ( 'output.pptx' )
310+ assert . ok ( format )
311+ const cacheIdentity =
312+ owner === 'project'
313+ ? fileDocumentCacheIdentity ( source , format , 'text/x-pptxgenjs' )
314+ : undefined
315+ const key = compiledArtifactKey (
316+ { entityType : owner , entityId : owner === 'workspace' ? workspaceId : projectId } ,
317+ source ,
318+ 'pptx' ,
319+ cacheIdentity
320+ )
309321 await storeCompiledDoc (
310322 { entityType : owner , entityId : owner === 'workspace' ? workspaceId : projectId } ,
311323 source ,
312324 'pptx' ,
313325 'application/vnd.openxmlformats-officedocument.presentationml.presentation' ,
314326 Buffer . from ( 'PK\u0003\u0004output-fixture' ) ,
315- undefined ,
316- ( writtenKey ) => {
317- key = writtenKey
318- }
327+ cacheIdentity
319328 )
320329 const path = resolve ( UPLOAD_DIR_SERVER , required ( key ) )
321330 assert . ok ( path . startsWith ( `${ resolve ( UPLOAD_DIR_SERVER ) } ${ sep } ` ) )
0 commit comments