fix(stac-api): avoid base64 encoding application/geo+json data#172
Conversation
| text_mime_types=[ | ||
| # Avoid base64 encoding any text/* or application/* mime-types | ||
| "text/", | ||
| "application/" |
There was a problem hiding this comment.
I don't know, this feels a little overbroad ... Could we just add the GeoJSON mime type instead?
There was a problem hiding this comment.
Yes, but there's also the Open API spec with application/vnd.oai.openapi;version=3.0. Your point regarding Parquet is valid though, would that have application/vnd.apache.parquet? And we probably wouldn't want to convert application/octet-stream either...
There was a problem hiding this comment.
I'm going to ship as-is to unblock, we can always dial it back later.
Not sure... We might as stac-geoparquet (or some other binary format) responses down the road, in which case we might want the conversion? |
## [9.2.1](v9.2.0...v9.2.1) (2025-07-29) ### Bug Fixes * **stac-api:** avoid base64 encoding application/geo+json data ([#172](#172)) ([51a1df0](51a1df0))
|
🎉 This PR is included in version 9.2.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
When using a REST API with a Lambda Proxy integration (such as when making use of our
PrivateLambdaApiGateway, link), data that Mangum converts to base64 is not converted to text by the API Gateway.By default, Mangum v0.14.1 converts any text data to base64 aside from its builtin defaults1. These defaults do not include
application/geo+jsonwhich is used by the STAC API. This PR upgrades Mangum (by utilizingstac-fastapi-pgstac's unspecifiedmangumversion2) and configures Mangum to avoid converting any data to base64 that begins withtext/orapplication/.Question: Perhaps we should just disable the base64 conversion completely by specifying a text mime type of
''which would match allmime_type in content_type3 lookups?Footnotes
https://github.com/Kludex/mangum/blob/0.14.1/docs/http.md#text-mime-types ↩
https://github.com/stac-utils/stac-fastapi-pgstac/blob/d43ea548103d0e157d7e22fb70f9ea9fe310509b/setup.py#L49C6-L49C15 ↩
https://github.com/Kludex/mangum/blob/0.14.1/mangum/handlers/utils.py#L79 ↩