Skip to content

URL-encode item hrefs with spaces in collection and item self-links #25

Description

@NewGraphEnvironment

Problem

Item link hrefs in collection.json (and the matching item self-links) are written with literal spaces for the 90 parenthesized filenames, e.g. https://stac-dem-bc.s3.amazonaws.com/082-..._2018 (2).json. A literal space is invalid URI syntax — lenient clients (browsers, aws cli) tolerate it, but strict ones fail: during the 2026-07-19 pgstac registration, curl rejected all 90 unencoded URLs, producing empty fetches that the registration count guard caught (see NewGraphEnvironment/rtj#196 for the registration-side context).

scripts/stac_utils.py already has encode_url_for_gdal() for the same problem on asset access; the link/self hrefs just never got the same treatment.

Proposed Solution

Percent-encode spaces (%20) wherever the pipeline constructs catalog URLs from item ids:

  • the item link target in scripts/item_create.py (f"{PATH_S3_STAC}/{result['id']}.json")
  • the item self href written into each item JSON

The 90 existing items need a one-time touch-up (rewrite their link hrefs + self hrefs, re-upload the affected item JSONs and collection.json). Registration for 2026-07 was completed by encoding at fetch time, so this is not urgent — but every future full re-registration and any strict STAC client hits it until fixed.

Relates to #8
Relates to #23

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions