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 <eric.daigle@mailbox.org>
This commit is contained in:
Eric Daigle
2025-08-28 11:36:13 +00:00
committed by GitHub
parent c0116ebbec
commit c867fd7319

View File

@@ -131,6 +131,9 @@ export async function searchLocationReverse(lat: number, lon: number) {
const nominatimURL = env.PUBLIC_NOMINATIM_URL ?? "https://nominatim.openstreetmap.org" const nominatimURL = env.PUBLIC_NOMINATIM_URL ?? "https://nominatim.openstreetmap.org"
const r = await fetch(`${nominatimURL}/reverse?lat=${lat}&lon=${lon}&format=geojson&addressdetails=1`, { const r = await fetch(`${nominatimURL}/reverse?lat=${lat}&lon=${lon}&format=geojson&addressdetails=1`, {
method: "GET", method: "GET",
headers: new Headers({
"User-Agent": "wanderer/" + version
})
}); });
if (!r.ok) { if (!r.ok) {
const response = await r.json(); const response = await r.json();
@@ -212,4 +215,4 @@ export async function searchActors(q: string, includeSelf: boolean = true): Prom
return [] return []
} }
} }