Skip to content

Commit 311e668

Browse files
committed
fix: correct STAC API URL construction in register.py
Don't strip /stac from base URL - client.self_href already points to correct endpoint.
1 parent e3260aa commit 311e668

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/register.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ def upsert_item(client: Client, collection_id: str, item: Item) -> None:
6666
except Exception:
6767
exists = False
6868

69-
stac_url = str(client.self_href).rstrip("/stac") # Remove /stac suffix if present
69+
# Use client's base URL directly (includes /stac if present)
70+
base_url = str(client.self_href).rstrip("/")
7071
if exists:
7172
# DELETE then POST (pgstac doesn't support PUT for items)
72-
delete_url = f"{stac_url}/collections/{collection_id}/items/{item.id}"
73+
delete_url = f"{base_url}/collections/{collection_id}/items/{item.id}"
7374
client._stac_io.session.delete(delete_url, timeout=30)
7475
logger.info(f"Deleted existing {item.id}")
7576

7677
# POST new/updated item
77-
create_url = f"{stac_url}/collections/{collection_id}/items"
78+
create_url = f"{base_url}/collections/{collection_id}/items"
7879
resp = client._stac_io.session.post(
7980
create_url,
8081
json=item.to_dict(),

0 commit comments

Comments
 (0)