Repository navigation
Conversation
…) (#880) Co-authored-by: JOY <anh@metados.com>
* fix(web): skip stored image entries that are not URLs (#810) Fourteen TGDD listings store the literal "[object Object]" ahead of their real CDN URLs, so merchant pages requested /merchants/[object Object] and showed broken thumbnails. Add isImageUrl/firstImageUrl to rate-domain-core and use them wherever a stored images list was read by its first entry, and in resolveProductImageUrl's fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): filter junk images in hero suggestions, JSON-LD and thumbnails (#810) Review follow-ups: hero search suggestions cut images to the first entry before it was checked, and the product JSON-LD listed every stored entry, junk included. Add usableImageUrls and use it there. resolveProductImageUrl also checks the stored thumbnail, and entries with surrounding whitespace are trimmed instead of rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): check the thumbnail too and require a host in image URLs (#810) CodeRabbit on #871: "thumbnail || firstImageUrl(images)" still picked a junk thumbnail, and isImageUrl accepted "//". Add productImageUrl, which tries the thumbnail and then the stored images, and require a host after "//" or "http(s)://". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: JOY <anh@metados.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…881) Unknown paths kept the site's default title and a missing comparison was titled "Đối đầu 1v1", although both render the 404 page. Give the catch-all route a localized "not found" title and use it for both 404 branches of /compare/[versus]; drop the unused fallback title. Co-authored-by: JOY <anh@metados.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Promotes
devtomain:"[object Object]"inimagesshow their real thumbnail (fix(web): product thumbnails render as "[object Object]" for TGDD listings #810)No
supabase/changes.🤖 Generated with Claude Code
📌 TL;DR
This PR hardens the Shopee importer against malformed data (C1 control characters, non-standard ports, boolean type coercion) and introduces a robust image URL validation utility to prevent rendering junk data like
[object Object]in the web frontend. It also fixes 404 page metadata to ensure correct localized titles for accessibility and SEO.🎯 Type of Change
🔍 Changes Walkthrough
apps/importer/src/shopee/entity-matcher.ts\p{Cc}). Added port validation tosanitizeHttpUrl(rejects non-80/443). Added boolean type rejection totoBoundedPositiveInt/Number.apps/importer/src/shopee/paging.tsresolveBackfillSupabaseTargetto validate Supabase URLs (scheme, credentials, control chars). HardenedfetchAllPagesagainst boolean inputs and non-array data. UpdatedparseShopeeEnqueueUrlto reject C1 chars and non-standard ports.apps/importer/src/shopee/logger.tssanitizeAiGeneratedTextto handleNaN/invalidmaxLenand strip C1 chars. AddedcleanFieldhelper toImporterStructuredLoggerto sanitize log metadata (component, run_id, etc.) against control characters and excessive length.apps/importer/src/shopee/shopee-to-supabase.tsplatformReviewIdForto sanitize review IDs (strip C1 chars, enforce 160 char limit). Added sanitization for reviewvideosandreviewer.profileUrl. UpdatedhasPopulatedSpecificationGroupsto ignore blank/whitespace array items.apps/importer/src/shopee/jobs/*.tsbackfill-review-risk,backfill-specs) to use the newresolveBackfillSupabaseTargetfor safe URL handling.apps/web/src/lib/rate-domain-core.tsisImageUrl,usableImageUrls,firstImageUrl, andproductImageUrlutilities to filter out invalid image strings (e.g.,[object Object]) and resolve valid thumbnails.apps/web/src/app/[locale]/[...rest]/page.tsxgenerateMetadatato the catch-all 404 page to ensure it has a localized "Page Not Found" title (WCAG 2.4.2).apps/web/src/app/[locale]/compare/[versus]/page.tsxgenerateMetadatato return 404 titles for invalid compare slugs instead of a generic fallback.apps/web/src/app/[locale]/**/*.tsxitem.images[0]) with the newproductImageUrlandfirstImageUrlutilities across Home, Product Detail, Category, and Compare pages.apps/web/src/components/**/*.tsxCompareWorkspace,HeroSearchInspector,DeepInspectWorkspace, andWatchlistWorkspaceto use the new image resolution utilities.apps/web/src/lib/hero-products.tstoHeroProductSuggestionsto useusableImageUrlsto ensure the hero search box only receives valid image URLs.apps/web/locales/*.jsonversusMetaFallbackTitlekeys as the 404 title logic now handles these cases.apps/web/e2e/*.spec.ts[object Object]is not requested as a URL).apps/web/e2e/seed.sql[object Object]in image arrays to test the new filtering logic.apps/web/package.jsonimage-url.test.tsto the test script.apps/importer/src/shopee/__tests__/*.ts📊 Architectural Flow
flowchart TD subgraph "Data Ingestion (Importer)" A[Raw Shopee Data] --> B{Sanitization Layer} B -->|URLs| C[sanitizeHttpUrl] C -->|Rejects| C1[C1 Chars, Non-80/443 Ports, Credentials] C -->|Accepts| C2[Clean HTTP/HTTPS URL] B -->|Numbers| D[toBoundedPositiveInt/Number] D -->|Rejects| D1[Boolean Inputs] D -->|Accepts| D2[Bounded Number] B -->|Supabase Config| E[resolveBackfillSupabaseTarget] E -->|Rejects| E1[Bad Scheme, Credentials, C1 Chars] E -->|Accepts| E2[Valid Supabase URL] end subgraph "Web Frontend" F[Product Data] --> G{Image Resolution} G --> H[isImageUrl] H -->|Rejects| H1["[object Object]", Empty, Invalid Paths] H -->|Accepts| H2[Valid Image URL] H2 --> I[productImageUrl / firstImageUrl] I --> J[Render <img> Tag] K[404 Route] --> L[generateMetadata] L --> M[Localized 404 Title] end