Skip to content

Conversation

Copy link

Copilot AI commented Sep 22, 2025

The ImageConverter.CheckAndConvertToCompleteUrl method was not correctly handling image paths that contain banners/ 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:

https://artworks.thetvdb.com/v4/series/462199/banners/67eef3239c55e.jpg

Instead of the correct:

https://artworks.thetvdb.com/banners/v4/series/462199/banners/67eef3239c55e.jpg

Root Cause

The logic used !input.Contains("banners/") to determine whether to prepend the banners path. This meant that any input already containing banners/ anywhere in the string would skip the prepending, even if it didn't start with banners/.

Solution

Changed the condition to !input.StartsWith("banners/") to ensure the banners/ prefix is always added unless the input already starts with banners/ or is a complete HTTP(S) URL.

Impact

  • ✅ Fixes broken image URLs for paths with nested banners directories
  • ✅ Maintains all existing behavior for other input types
  • ✅ Minimal change with no risk of regression
  • ✅ Added verification test to prevent future issues

Testing

All scenarios verified:

  • v4/series/462199/banners/67eef3239c55e.jpghttps://artworks.thetvdb.com/banners/v4/series/462199/banners/67eef3239c55e.jpg
  • some-image.jpghttps://artworks.thetvdb.com/banners/some-image.jpg
  • banners/existing.jpghttps://artworks.thetvdb.com/banners/existing.jpg
  • http://external.com/img.jpghttp://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.

Copy link
Author

Copilot AI commented Sep 22, 2025

@cjaliaga 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] ImageConverter does not prepend banners path correctly for TVDB images Fix ImageConverter to properly prepend banners path for all non-HTTP URLs Sep 22, 2025
Copilot AI requested a review from cjaliaga September 22, 2025 23:07
Copilot finished work on behalf of cjaliaga September 22, 2025 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImageConverter does not prepend banners path correctly for TVDB images

2 participants