@@ -30,18 +30,16 @@ import {
3030import { resolveServableImageBytes } from '@/lib/uploads/server/image-derivative'
3131import { resolveStoredFileContext } from '@/lib/uploads/server/metadata'
3232import { MAX_BUFFERED_TRANSFER_BYTES } from '@/lib/uploads/shared/types'
33- import {
34- inferContextFromKey ,
35- needsRenderedArtifact ,
36- resolveEffectiveMimeType ,
37- } from '@/lib/uploads/utils/file'
33+ import { inferContextFromKey , resolveEffectiveMimeType } from '@/lib/uploads/utils/file'
3834import { internalWorkspaceFileServeAuth } from '@/lib/workspace-files/api'
3935import { fetchAuthorizedServableWorkspaceFileBuffer } from '@/lib/workspace-files/application/fetch-servable-workspace-file-buffer'
4036import { finishFileDelivery } from '@/lib/workspace-files/application/finish-file-delivery'
4137import { readWorkspaceFileRecordByKey } from '@/lib/workspace-files/application/read-workspace-file-record-by-key'
4238import { streamAuthorizedWorkspaceFile } from '@/lib/workspace-files/application/stream-authorized-workspace-file'
43- import { isSimPageSource , SIM_PAGE_CONTENT_TYPE } from '@/lib/workspace-files/page-compile'
39+ import { isSimPageSource } from '@/lib/workspace-files/page-compile'
40+ import { SIM_PAGE_CONTENT_TYPE } from '@/lib/workspace-files/page-content-type'
4441import { renderSimPageDocumentWithAssets } from '@/lib/workspace-files/page-document.server'
42+ import { servesStoredBytes } from '@/lib/workspace-files/stored-bytes'
4543import { type KnowledgeFileAccess , verifyFileAccess } from '@/app/api/files/authorization'
4644import {
4745 createConditionalFileResponse ,
@@ -203,10 +201,10 @@ async function resolveTransformedBytes(params: {
203201 * Whether a request is answered with the stored object byte-for-byte, so its bytes can stream from
204202 * storage instead of being read whole and capped at the transfer ceiling.
205203 *
206- * Every other answer is produced from the bytes and stays buffered: a Sim page renders, a generated
207- * document compiles, and a `preview` may be a HEIC transcode — sniffed from the content, so no name
208- * or type rules it out. What streams is exactly what {@link resolveServableBytes} and the
209- * workspace resolver would have passed through unchanged.
204+ * Every other answer is produced from the bytes and stays buffered: see { @link servesStoredBytes},
205+ * plus a `preview`, which may be a HEIC transcode — sniffed from the content, so no name or type
206+ * rules it out. What streams is exactly what {@link resolveServableBytes} and the workspace
207+ * resolver would have passed through unchanged.
210208 */
211209function servesStoredObject (
212210 filename : string ,
@@ -215,12 +213,7 @@ function servesStoredObject(
215213) : boolean {
216214 if ( options . raw ) return true
217215 if ( options . preview ) return false
218- if ( recordedType === SIM_PAGE_CONTENT_TYPE || filename . toLowerCase ( ) . endsWith ( '.html' ) ) {
219- return false
220- }
221- // A recorded type tells a finished upload from a generation source; without one, every
222- // document name may be a source.
223- return ! needsRenderedArtifact ( recordedType , filename )
216+ return servesStoredBytes ( recordedType , filename )
224217}
225218
226219/**
0 commit comments