Fix ImageConverter to properly prepend banners path for all non-HTTP URLs #79
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.
The
ImageConverter.CheckAndConvertToCompleteUrlmethod was not correctly handling image paths that containbanners/but don't start with it. This caused incorrect URL construction for certain TheTVDB image paths.Problem
When TheTVDB returns paths like
v4/series/462199/banners/67eef3239c55e.jpg, the method would incorrectly generate:Instead of the correct:
Root Cause
The logic used
!input.Contains("banners/")to determine whether to prepend the banners path. This meant that any input already containingbanners/anywhere in the string would skip the prepending, even if it didn't start withbanners/.Solution
Changed the condition to
!input.StartsWith("banners/")to ensure thebanners/prefix is always added unless the input already starts withbanners/or is a complete HTTP(S) URL.Impact
Testing
All scenarios verified:
v4/series/462199/banners/67eef3239c55e.jpg→https://artworks.thetvdb.com/banners/v4/series/462199/banners/67eef3239c55e.jpg✅some-image.jpg→https://artworks.thetvdb.com/banners/some-image.jpg✅banners/existing.jpg→https://artworks.thetvdb.com/banners/existing.jpg✅http://external.com/img.jpg→http://external.com/img.jpg✅Fixes #78.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.