Repository navigation
fix(event): resolve event image URLs (populate filename + prefix origin) - #34
Merged
Merged
Conversation
Event detail views crashed on the ErrorBoundary for any event with images: getEvent populated the image `url` (a SahajCloud virtual field derived from `filename`) without selecting `filename`, so `url` came back null and failed the `z.string()` parse. Select `filename` so the virtual url resolves, and drop the non-existent `thumbnailURL` (removed in favour of Cloudflare Images variants). Resolved dev URLs are relative (`/api/images/file/…`) and 404 against the widget's own origin, so add a `resolveImageUrl` helper that prefixes them with the SahajCloud origin (absolute prod CDN URLs pass through unchanged). Apply it to the carousel slides and the OG/JSON-LD image. Harden EventImageSchema.url to nullish and skip url-less images in the carousel and metadata so a future file-less image can't crash the whole event read. Closes #33 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per /simplify (altitude): move resolveImageUrl from the two UI call-sites (EventDetails carousel, EventMetadata OG image) into getEvent's return shaping — the same place `path` is derived to normalize a SahajCloud wire quirk. Components now consume ready-to-use absolute URLs and no longer depend on VITE_SAHAJCLOUD_URL; any future images consumer is correct by default. The raw EventDocSchema stays wire-faithful (resolution happens after parse); the UI keeps only its render-time null-image filtering. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
resolveImageUrl now falls back to the raw url instead of throwing when the
SahajCloud origin is empty/misconfigured: `new URL('/api/…', '')` throws, and
since resolution runs inside getEvent's image map, a throw would drop the whole
event to the ErrorBoundary. Honors this PR's "one bad image can't fail the event
read" invariant and matches how the axios client degrades under the same misconfig.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per security review: resolveImageUrl now returns string | null, resolving only http(s) URLs and dropping the rest — a non-http(s) scheme (data:/javascript:) or an empty/misconfigured origin (which makes `new URL` throw) yields null instead of a raw, un-encoded string. This stops a hostile CMS image url from smuggling a `</script>` breakout payload into the OG/JSON-LD metadata, and keeps a bad env from failing the whole event read. getEvent and both UI consumers already skip null urls. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Ardnived
added a commit
that referenced
this pull request
Nov 7, 2026
…eep (#371) * fix(map): remember where a fly is going, not where it left Prague search, open the Brno class, close it, open another straight away, close that: the list said Prague but the map settled on Brno. The saved camera came from the store, which only updates when the map stops, so a click during the fly-back recorded the old place. Save the destination of a move in flight instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(search): a new place search drops the country chosen earlier United Kingdom, then Tuesday, then a search for Prague kept region=gb, so the list looked for Prague inside the United Kingdom and said "No events within 150 km". The place-search builder carried every filter across, the region included. The region is a Where, so it now goes with the old place in preserveSearchState, for the search box, Near me and the IP suggestion alike. The other filters still travel. Ported from 2160576 on ux/fix-filters. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(search): typing in the search field leaves the URL alone until a place is picked On the results page the field wrote every keystroke into ?q, and the cards read their "from" place from there. Clearing a London search and typing "Prag" made every card say "5.1 km from Prag" over London's classes. The field now keeps what is typed to itself, and the URL changes only when a place is picked (or Near me names one). Every other field already opted out with syncToUrl={false}, so the option goes with the behaviour, and the comments that claimed per-keystroke ?q churn are corrected. Ported from the MapSearch part of 3300572 on ux/first-screen. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(filters): apply URL filters to browse lists and counts A link carrying filters (/gb/south-east/london?format=online, /gb?days=2) showed the filter badge and filtered pins over an unfiltered list and counts: London listed all 19 in-person classes with no pins on the map, and the UK page counted every class per region. The country, region and online lists now run the map's own matchesFilters check, show the removable filter pills, offer the no-results state with Clear filters, and keep the filters on the links one level down. Framing still covers every class, and the unfiltered query keys stay as they were, so live preview's writer still lands. Ported from 032f476 on ux/states. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(nav): a typed or old address climbs the real places behind it A place resolves by its last slug alone, so /united-kingdom/south-east/london opens London even though the UK's slug is gb. The panels behind it were built from the typed words, so the first X opened /united-kingdom/south-east, the second "We couldn't find that place", and the peek strip read "Back to united-kingdom". placedPathname swaps the deepest place's address for the one the region tree gives it, and the strips and the climb read that, so they name and lead to United Kingdom at /gb. The top view and the address bar keep the typed address, so nothing remounts when the tree arrives. After 19637c6 on ux/navigation, rebuilt on main's stack (that commit's own targets, the Back label and breadcrumbs, are proposal files). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(registration): offer autofill on the name and email fields The sign-up form's Name and Email fields carried no autocomplete token, so phones didn't offer the visitor's own name and email. They now say autocomplete="name" and "email". The other half of the report's finding, making "privacy policy" a link inside the consent sentence, needs a %{link} slot in SahajCloud's copy first, so it is left for a SahajCloud change. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(search): suggest places in the country being looked at first Suggestions were ranked from the middle of the map with no country limit, so "Hampstead" from the UK page offered four streets near Manchester, then Hampstead, Quebec, and never the London district; from the home page Quebec came first. The field now asks for places, not bare streets, and stays in one country: the one on screen, else the searched place's (?cc), else the last country page shown (DrawerStack records it, since /search names none), else the client's home country. A search that finds nothing there repeats itself everywhere, so Prague is still one search away from the UK page. With no country to stay in, results rank from the visitor's own area instead of the middle of a world map. After f0b3a1a on ux/first-screen; its "search all countries" button needed new copy, so the release happens by itself instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(search): say so when a typed place doesn't exist Typing a place that doesn't exist ("zzqqxx") left the country list as it was, with no answer at all. The field now says "We couldn't find that place." under itself once the search, widened to every country, comes back empty. The line reuses the existing not-found copy. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(search): no distance on results when no place was searched /search?days=2®ion=gb, opened from the filters with no town searched, printed "5,652 km away" on every UK class: with no searched place the list is measured from wherever the middle of the map was, and "away" reads as "from you". The list already knows nothing was searched (hasSearchCenter), so it now tells its cards not to print a distance. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(first-screen): a late "Looking for classes near…" line no longer moves the list The location notice appears once the visitor's rough location comes back. On a slow lookup it landed after the list had painted and pushed the rows 48px down under the visitor's finger. Each list now mounts it twice: above the list only if the answer was known at the first paint, below the list only if it came later, where it moves nothing. The layout half of 21f1592 on ux/first-screen; its "show it only where it helps" change is a proposal and stays out. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(nav): a dead place link offers only its way out /gb/no-such-place said "We couldn't find that place" under a header with no title but working Calendar, Search and Filters buttons, all scoped to a place that doesn't exist. The error chrome now leaves those three out when the page failed because the place isn't there. A region that failed to load (offline, server) keeps them, since there they still lead where the visitor wanted. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(turnstile): wait longer before calling the security check blocked When the hidden Turnstile check didn't answer within 10 seconds, the whole Atlas became "This Atlas can't run on this page", which a slow load did by itself about once in 30 loads on an iPhone. The error screen stays (#182's decision), but the handshake now waits 20 seconds, and the page-wide check gives a silent frame one fresh retry before deciding. A frame that answers "error" (SahajCloud refusing this page's domain) is still believed at once, so a partner site on no client's allowed list hears it as fast as before. docs/embedding.md now says how long a refusing CSP takes to show. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(registration): give the collapsed captcha slot no gap of its own Since #366 the captcha frame is 0px tall until Cloudflare asks for a click, which is what most visitors see. The slot was still a flex item, so it took its column's gap on both sides: the registration form showed 24px of blank where 12px belonged, while the report form cancelled the same gap by hand with -mt-4. useTurnstile, which already owns the slot and the frame's height, now takes the slot out of flow while the frame is collapsed (and when the check is disabled), and puts it back when Cloudflare wants a click. Neither form reads `interactive` for spacing any more. Measured on the register route with a challenge that never answers: fields, then the buttons 20px below (the 12px gap plus the bar's own 8px), where the collapsed slot used to add another 12px. The captcha-slot half of #367; its AddToCalendar follow-ups are untouched. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(embed): a deep link into a hidden tab waits for the tab to open A host page that keeps the Atlas in a closed tab or accordion broke when the visitor arrived from a shared link (?atlas=/gb). A page route makes the loader mount at once, and the widget decides its layout once, from its element's size at its first render. Inside display:none that was 0x0, which reads as an unsized embed, so when the tab opened the panel floated over the host page in the top-left corner, the map was a 400x300 patch, and the host's box stayed blank. The same page without ?atlas= worked, because a lazy mount waits for the element to intersect the viewport. The loader now mounts a deep link at once only into an element that has a box (getClientRects), and otherwise waits for it to be shown, as a lazy one does. Checked on a local host page: the live embed reproduces the fault, this build fills the 1232x644 box with the UK page and its map. docs/embedding.md says so under Sizing and beside the deep-link rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): the hidden-tab deep link and the longer security-check wait Both are visible to a host: an embed in a closed tab now loads when shown, and a refusing CSP shows the blocked screen after about 40 seconds instead of 10. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(search): release the country scope for one query only The release was a bare country code and nothing cleared it, so the first search that came back empty inside the country — the typo that proves #34 — handed every later search in that field the worldwide ranking. Mapbox puts Hampstead, Quebec above Hampstead, London once no country is given, so one miss undid the country scope for the rest of the session. `searchCountryScope` keys the release to the query that earned it, so the next query starts inside the country again. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW53aCCKJirBwMxQS8 * fix(filters): count online classes under the region cut The home list's online badge filtered the cached feed in the view, with `matchesFilters` and no region matcher. That reads a selected region as no restriction, so on `/?region=gb` the badge counted online classes worldwide while every card below it honoured the cut — the disagreement #7 exists to close. `getOnlineCount` derives it through `visibleFeatures`, the same predicate the country counts and the map's pins use. `['countries']` keeps its plain key, so the stories' own seeding still lands. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW53aCCKJirBwMxQS8 * fix(filters): name the active-filters question once Three spellings of one predicate had appeared across the browse views — `filterSearch`, `Boolean(filterSearch)` and `hasActiveFilters(filters)`. The first two read a filter set through the query string it serializes to, which is a different question. `hasActiveFilters` is what the data layer gates on, so every view asks it now. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW53aCCKJirBwMxQS8 * refactor(search): stop the live-region local shadowing the country scope The hoist effect called its element `scope`, the name the country restriction above it already has. Two unrelated meanings under one name in one component. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW53aCCKJirBwMxQS8 * docs(state): say why the browsed country is a store, not the URL The state rule still counted six stores and listed neither of the two this branch adds, and nothing said why the browsed country sits outside the URL when the rule puts search state in it — `?cc` already carries a country, so the answer is not obvious. Both reasons are written down now: what a link must reproduce, and which question `?cc` answers instead. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW53aCCKJirBwMxQS8 * fix(registration): link the privacy policy inside the consent line "privacy policy" in the sign-up consent line was plain text. A translation can now mark the words that link as <link>…</link>, and the form renders them as a link to https://wemeditate.com/privacy, wherever the language puts them. The code owns the href, and nothing in the string is rendered as markup. The existing key, registration.form.privacy_policy, keeps working unmarked: it reads as plain text, as it does today, until an admin adds the span to it in SahajCloud. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(data-layer): list the online-count fetcher The fetcher list is what tells the next author where a derived count comes from, and `getOnlineCount` was missing from it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW53aCCKJirBwMxQS8 * docs(embedding): say what the geocoder now sends The place search changed what it asks Mapbox for: a country to stay inside, and at world zoom a request to rank by the visitor's own IP rather than a map centre that says nothing there. The privacy section still described the old pair, and it is the only page a host reads before writing their own notice. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW53aCCKJirBwMxQS8 --------- Co-authored-by: antontcymbal <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ErrorBoundaryfor any event with images:getEventpopulated the imageurl(a SahajCloud virtual field derived fromfilename) without selectingfilename, sourlcame backnulland failed thez.string()parse. Selectingfilenamemakes the virtualurlresolve;thumbnailURL(which doesn't exist on the collection) is dropped./api/images/file/…) and 404 against the widget's own origin, so image URLs are origin-prefixed against the SahajCloud origin (absolute prod CDN URLs pass through). Resolution happens once at the data boundary (getEvent), so the carousel, lightbox, and OG/JSON-LD metadata all get ready-to-use absolute URLs.Changes
src/config/api/fetch.ts—getEventselectsfilename(dropsthumbnailURL) and resolves each image URL in its return shaping, next to the existingpathderivation.src/lib/shape/image.ts(new) —resolveImageUrl(url, origin)→string | null: origin-prefixes relative URLs, passes absolute ones through, and drops non-http(s) schemes / unresolvable urls.src/types/event.ts—EventImageSchemadropsthumbnailURLand makesurlnullish (a file-less image no longer fails the parse).src/components/organisms/EventDetails/EventDetails.tsx,src/components/molecules/EventMetadata/EventMetadata.tsx— consume the already-resolved URL and skip images without one.Verification
pnpm lint)pnpm typecheck)pnpm test:run), incl. the URL helper (relative-prefix / absolute passthrough / scheme rejection / empty-origin),EventDocSchemaparsing the realfilename+relative-urlshape and tolerating a null url, andgetEventresolving image URLs at the boundary.ladle:build) — TypeScript/logic-only change, no new deps or config.curl, bypassing browser CORS) that the imageurlresolves only whenfilenameis selected — the exact root cause.Manual / visual verification (please confirm)
The in-browser render check couldn't be completed in this session: the local SahajCloud backend (
:3000) rejects the Vite dev origin (:5173) with a CORS preflight failure on/api/clients/me— a pre-existing backend config condition, unrelated to this change — so the widget hits its Network-Error boundary before any event renders. Once the backend allows the dev origin, please confirm:/russia/voronezh/13— the detail view renders without hitting theErrorBoundary.Notes for reviewer
getEvent), not the UI call-sites — the same placepathis derived to normalize a SahajCloud wire quirk. Components no longer depend onVITE_SAHAJCLOUD_URL, and any futureimage.urlconsumer is correct by default. The rawEventDocSchemastays wire-faithful (resolution happens after parse).resolveImageUrlis scheme-gated tohttp(s)and returnsnullfordata:/javascript:schemes or an empty/misconfigured origin — so a hostile CMS image url can't smuggle a</script>payload into the OG/JSON-LD metadata, and a bad env degrades to a skipped image rather than a crash.EventMetadataembedsJSON.stringify(schema)in a<script type="application/ld+json">(unchanged by this PR).JSON.stringifydoesn't escape</>, and react-helmet commits<script>children viainnerHTML, so a CMS string containing</script>…inevent.title/description/ address fields is a stored XSS in the host page's origin. This PR closes the image vector into that sink but deliberately doesn't touch the broader field set. Suggested fix in a focused PR:JSON.stringify(schema).replace(/</g, '\\u003c'). Happy to file the ticket.Closes #33
🤖 Generated with Claude Code