From c867fd7319fa398f13ad44180933537d2877140c Mon Sep 17 00:00:00 2001 From: Eric Daigle Date: Thu, 28 Aug 2025 11:36:13 +0000 Subject: [PATCH] Add header to searchLocationReverse (#458) (#485) As described in #458, uploading trails intermittently fails because the request to the Nominatim API in `searchLocationReverse` does not contain a header as required by the API. The header was added to `searchLocations` in 47f431e, but the issue with the trail upload was caused by it missing in `searchLocationReverse`. This PR adds it there as well. Co-authored-by: Eric Daigle --- web/src/lib/stores/search_store.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/src/lib/stores/search_store.ts b/web/src/lib/stores/search_store.ts index cb067ed1..78ce7857 100644 --- a/web/src/lib/stores/search_store.ts +++ b/web/src/lib/stores/search_store.ts @@ -131,6 +131,9 @@ export async function searchLocationReverse(lat: number, lon: number) { const nominatimURL = env.PUBLIC_NOMINATIM_URL ?? "https://nominatim.openstreetmap.org" const r = await fetch(`${nominatimURL}/reverse?lat=${lat}&lon=${lon}&format=geojson&addressdetails=1`, { method: "GET", + headers: new Headers({ + "User-Agent": "wanderer/" + version + }) }); if (!r.ok) { const response = await r.json(); @@ -212,4 +215,4 @@ export async function searchActors(q: string, includeSelf: boolean = true): Prom return [] } -} \ No newline at end of file +}