Skip to content

Too restrictive media-type links (again) #186

@fmigneault

Description

@fmigneault

As previously raised in #181 and (partially) fixed in #182, the type property of item/collection links are limited to a specific subset, ie:

geotiff = "image/tiff; application=geotiff"
cog = "image/tiff; application=geotiff; profile=cloud-optimized"
jp2 = "image/jp2"
png = "image/png"
jpeg = "image/jpeg"
# Vector
geojson = "application/geo+json"
geojsonseq = "application/geo+json-seq"
geopackage = "application/geopackage+sqlite3"
kml = "application/vnd.google-earth.kml+xml"
kmz = "application/vnd.google-earth.kmz"
pbf = "application/x-protobuf"
mvt = "application/vnd.mapbox-vector-tile"
# Others
hdf = "application/x-hdf"
hdf5 = "application/x-hdf5"
xml = "application/xml"
json = "application/json"
ndjson = "application/ndjson"
html = "text/html"
text = "text/plain"
openapi = "application/vnd.oai.openapi+json;version=3.0"
openapi_yaml = "application/vnd.oai.openapi;version=3.0"
jsonschema = "application/schema+json"
pdf = "application/pdf"
csv = "text/csv"
parquet = "application/vnd.apache.parquet"
octet_stream = "application/octet-stream"

We are trying to integrate link references that contains application/x-netcdf type, and the STAC-FastAPI refuses the pushed STAC Item because of this. I would expect many more types to be causing problem, such as text/markdown, text/x-rst, application/vnd.restful+json, etc.

Therefore, the fix should be revisited, either to allow any types, but preferably with a string pattern check, to avoid revisiting this again when yet another type is needed later on. A potential pattern could be something similar to [\w-]+/[\w\-.]+\s*(;.+)* to allow the type/subtype check, and the optional parameters (eg: profile=cloud-optimized, charset=UTF-8, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions