grain.social is a photo sharing platform built on atproto. grain.social
appview atproto photography

fix: restore location on gallery detail and unbreak one-word place names master

Two separate bugs, both reached from the same link. getGallery hand-assembled its record from SELECT * and never read the `address` column, so hydrateGalleries could not build `locationDisplay` and a gallery detail page showed no location at all — while the same gallery in the feed showed "Waldport, Oregon, US". It now uses getRecords like every other caller, which reconstructs the whole record; that is why getActorFavorites and searchGalleries never had this bug, and it means a field added to Gallery later cannot be silently dropped again. 43 lines become 4. expandCountryAliases threw instead of returning nothing for a string that is not a country. normalizeCountry passes unrecognised input straight through, so `canon` is routinely something like "PARIS", and Intl.DisplayNames.of() raises RangeError on anything that is not a valid region code. The location feed tries a single-word display name as a country first, so every one-word place — Paris, Portland, Waldport, Forest Park — failed the whole request with invalid_argument before any matching ran, including the sibling locality interpretation that would have matched. The Intl call is now guarded. The feed's interpretation loop also staged its bind values so an unsatisfiable interpretation cannot leave orphaned parameters behind and shift every later placeholder number. Verified against local data: Paris, Portland and Forest Park return results where they previously errored, and the multi-part forms are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XPZzUb2PBrkuHzcAMfGLLY


+42 -52
3 changed files