Fix directory broken logos, ignored ?limit=, and missing screenshots - #563
Merged
Merged
Conversation
Three fixes to the directory, all found while verifying the rasterly swap. A page can declare <link rel="icon" href="data:,"> to suppress the favicon request. That parses as a valid URL and z.string().url() accepts it, so it was stored as logo_url and rendered as a broken image; example.com submits this way. Favicon and og:image hrefs now go through toHttpUrl(), which resolves them against the page and keeps them only if they end up http(s). The /favicon.ico last resort is HEAD-checked instead of asserted, so a site without one yields an empty logo rather than a link that 404s. GET /api/directory hard-coded a page size of 20 and silently dropped ?limit=. Every other list route in the app reads limit through parsePaginationParam, so this one now does too: default 20 (unchanged), max 50, and per_page in the response reports what was actually applied. scripts/backfill-screenshots.ts captures the listings that predate screenshots, through rasterly, reusing the storage path shape the route writes. It honours --dry-run and --limit, prints the quota left after each render and stops when the API says the budget is gone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
"shows loading state when loading more" queues a response that resolves 100ms later, asserts the Loading... label synchronously and then ends. The deferred promise resolves after the test is over, so loadMore's setReviews runs against a torn-down jsdom and vitest reports an unhandled "window is not defined" that fails the whole run. It only surfaced when adding a test file elsewhere shifted the scheduling, so the suite was one file away from going red at any time. Waiting for the label to clear keeps the state update inside the test's lifetime. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan45 finding(s) HIGH/CRITICAL: 1 | MEDIUM: 8 | LOW: 36
Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Three directory defects found while verifying the rasterly swap in #562, plus one test fix they exposed.
1.
logo_urlcame back as"data:,"A page can declare
<link rel="icon" href="data:,">to suppress the favicon request — example.com does. That parses as a valid URL and passesz.string().url(), so it was stored as a listing's logo and rendered as a broken image.Favicon and og:image hrefs now go through
toHttpUrl()(new, insrc/lib/meta-url.ts), which resolves them against the page and keeps them only if the result is http(s). The/favicon.icolast resort is HEAD-checked rather than asserted, so a site that serves no favicon yields an empty logo instead of a link that 404s. The submit form already doesif (logoUrl) body.logo_url = logoUrl, so an empty value is simply omitted.2.
GET /api/directoryignored?limit=It hard-coded a page size of 20 and dropped the param. Every other list route in the app reads
limitthroughparsePaginationParam, so this one now does too: default 20 (unchanged), max 50, andper_pagereports what was actually applied. The directory endpoints aren't inopenapi.json, so there's no spec to update.3. Listings with no screenshot
scripts/backfill-screenshots.tscaptures them through rasterly, reusing the storage path shape the route writes. Supports--dry-runand--limit, prints the quota remaining after each render, and stops when the API says the budget is gone.Already run against production: 2 listings were missing screenshots (Client Kit CrawlProof Receiver, OpenClaw Docs). Both captured;
GET /api/directorynow reports none missing. rasterly quota: 92 of 100 left this month.4. The test fix
UserReviews.test.tsx— "shows loading state when loading more" queues a response that resolves 100ms later, asserts synchronously, then ends. The deferred promise lands after jsdom teardown, sosetReviewsthrows an unhandledwindow is not definedthat fails the entire run.This was latent: it only surfaced because adding a test file elsewhere in this PR shifted vitest's scheduling. Master is green today, but was one file away from going red at any time. Verified by running the full suite on unmodified
fc3cc72(clean) and on this branch before the fix (1 unhandled error, exit 1).Verification
pnpm type-checkclean;eslintexits 0 on all changed filespnpm test:run— 223 files / 2143 tests pass, no unhandled errors, exit 0toHttpUrl(data:/about:/javascript: rejection, relative and protocol-relative resolution, unparseable input), 5 for directory pagination (limit honoured, offset paging, clamping, default)🤖 Generated with Claude Code