File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,13 +128,21 @@ async def handle_download(
128128 )
129129
130130
131- def image_response_from_bytes (image_bytes : bytes ) -> Response :
131+ def image_response_from_bytes (
132+ image_bytes : bytes ,
133+ * ,
134+ headers : dict [str , str ] | None = None ,
135+ ) -> Response :
132136 media_type = guess_mime_type (image_bytes )
133137 if media_type is None :
134138 raise NotFoundException ("Invalid image format" )
135139
140+ _headers = {"cache-control" : "max-age=3600" }
141+ if headers :
142+ _headers .update (headers )
143+
136144 return Response (
137145 content = image_bytes ,
138146 media_type = media_type ,
139- headers = { "cache-control" : "max-age=3600" } ,
147+ headers = _headers ,
140148 )
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ async def get_file_preview(
180180 if pvw_bytes == b"" :
181181 raise NotFoundException ("File preview not available" )
182182
183- return image_response_from_bytes (pvw_bytes )
183+ return image_response_from_bytes (pvw_bytes , headers = { "X-File-ID" : file_id } )
184184
185185
186186async def uncache_file_preview (project_name : str , file_id : str ) -> None :
You can’t perform that action at this time.
0 commit comments