(
bundle_id: str,
request: Request,
)
| 16 | responses={422: {"description": "Unprocessable Entity"}}, |
| 17 | ) |
| 18 | async def api_get_bundle_icon( |
| 19 | bundle_id: str, |
| 20 | request: Request, |
| 21 | ): |
| 22 | bundle = get_bundle(bundle_id) |
| 23 | if not bundle: |
| 24 | raise_http_error( |
| 25 | ErrorCode.OBJECT_NOT_FOUND, |
| 26 | message=f"bundle {bundle_id} not found.", |
| 27 | ) |
| 28 | |
| 29 | current_path = os.path.dirname(os.path.abspath(__file__)) |
| 30 | png_file_path = f"../../bundles/{bundle_id}/resources/icon.png" |
| 31 | abs_png_file_path = os.path.join(current_path, png_file_path) |
| 32 | |
| 33 | return FileResponse( |
| 34 | path=abs_png_file_path, |
| 35 | headers={"Content-Disposition": "inline"}, |
| 36 | media_type="image/png", |
| 37 | filename=f"{bundle_id}.png", |
| 38 | ) |
nothing calls this directly
no test coverage detected