fix(external-link): replace TMDB ID with IMDB ID for Trakt links#2934
fix(external-link): replace TMDB ID with IMDB ID for Trakt links#29340xSysR3ll merged 1 commit intoseerr-team:developfrom
Conversation
…Trakt links
Trakt's V3 migration broke the search URL (/search/tmdb/{id}) for free users, redirecting them to
the homepage instead od te media page.
fix seerr-team#2773
📝 WalkthroughWalkthroughThe PR fixes broken Trakt links by replacing the Trakt link rendering condition from using Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/ExternalLinkBlock/index.tsx (1)
106-117:⚠️ Potential issue | 🔴 CriticalTrakt link URLs are broken—
imdbIdcannot be used directly as a URL slug.Trakt.tv URLs require slugs in the format
title-year(e.g.,trakt.tv/movies/the-martian-2015), not raw IMDb IDs. While the Trakt API supports IMDb lookups via/search/imdb/{id}, the frontend website does not accept direct IMDb ID slugs. The current code will generate URLs likehttps://trakt.tv/movies/tt0111161that return 404 errors.To fix this, either:
- Use Trakt's search endpoint:
https://trakt.tv/search/imdb/{imdbId}- Obtain and use the Trakt slug from metadata (if available)
- Revert to a working method if TMDB search flow was previously functional
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/ExternalLinkBlock/index.tsx` around lines 106 - 117, The Trakt link in ExternalLinkBlock is using imdbId as a URL slug which causes 404s; update the href construction in the JSX that renders the Trakt <a> (the block checking imdbId && mediaType !== 'person' that currently builds `https://trakt.tv/${mediaType === 'movie' ? 'movies' : 'shows'}/${imdbId}`) to instead use Trakt's IMDb search URL (`https://trakt.tv/search/imdb/{imdbId}`), or if your component/props include a precomputed Trakt slug (e.g., traktSlug or metadata.traktSlug), prefer using that slug for `trakt.tv/movies/{slug}` or `trakt.tv/shows/{slug}`; ensure the change still uses mediaType to choose movies vs shows and preserves target="_blank" and rel attributes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/components/ExternalLinkBlock/index.tsx`:
- Around line 106-117: The Trakt link in ExternalLinkBlock is using imdbId as a
URL slug which causes 404s; update the href construction in the JSX that renders
the Trakt <a> (the block checking imdbId && mediaType !== 'person' that
currently builds `https://trakt.tv/${mediaType === 'movie' ? 'movies' :
'shows'}/${imdbId}`) to instead use Trakt's IMDb search URL
(`https://trakt.tv/search/imdb/{imdbId}`), or if your component/props include a
precomputed Trakt slug (e.g., traktSlug or metadata.traktSlug), prefer using
that slug for `trakt.tv/movies/{slug}` or `trakt.tv/shows/{slug}`; ensure the
change still uses mediaType to choose movies vs shows and preserves
target="_blank" and rel attributes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a92e9ab5-5232-4661-8d6d-ccb5edfc49e0
📒 Files selected for processing (1)
src/components/ExternalLinkBlock/index.tsx
There was a problem hiding this comment.
Pull request overview
Updates the Trakt external link generation in the UI to avoid the deprecated/broken TMDB-search-based Trakt URLs and instead link directly to Trakt movie/show pages via IMDb IDs, resolving the redirect-to-homepage issue reported in #2773.
Changes:
- Switch Trakt links from
/search/tmdb/{tmdbId}to direct/movies/{imdbId}and/shows/{imdbId}URLs. - Gate Trakt link rendering on
imdbIdavailability (instead oftmdbId) for non-person media.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Trakt's V3 migration broke the search URL (/search/tmdb/{id}) for free users, redirecting them to the homepage instead of the media page.
Switch to using IMDB with direct V3-compatible URLs:
Movies: https://track/movies/{imdbid}
Shows: https://track/shows/{imdbid}
Fixes Trakt links are broken #2773
How Has This Been Tested?
pnpm testcommand.Screenshots
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit