fix: isFormatSupported now correctly extracts extension

Address review comment #6:
- isFormatSupported() was passing the full path to supportsFormat()
  which only matches extensions like ".jpg", so it always returned false
- Delegate to getDecoder() which correctly extracts the extension first
This commit is contained in:
Martin Brook 2026-01-30 17:48:40 +00:00
parent b11ed2ea26
commit ff28388b04

View File

@ -50,13 +50,7 @@ ImageToFramebufferDecoder* ImageDecoderFactory::getDecoder(const std::string& im
} }
bool ImageDecoderFactory::isFormatSupported(const std::string& imagePath) { bool ImageDecoderFactory::isFormatSupported(const std::string& imagePath) {
if (jpegDecoder && jpegDecoder->supportsFormat(imagePath)) { return getDecoder(imagePath) != nullptr;
return true;
}
if (pngDecoder && pngDecoder->supportsFormat(imagePath)) {
return true;
}
return false;
} }
std::vector<std::string> ImageDecoderFactory::getSupportedFormats() { std::vector<std::string> ImageDecoderFactory::getSupportedFormats() {