@@ -474,17 +474,30 @@ ImageInput::create (const std::string &filename,
474474
475475
476476ImageInput *
477- ImageInput::create (const std::string &filename,
477+ ImageInput::create (const std::string &filename,
478478 bool do_open,
479479 const std::string &plugin_searchpath)
480480{
481- if (filename.empty ()) { // Can't even guess if no filename given
481+ // In case the 'filename' was really a REST-ful URI with query/config
482+ // details tacked on to the end, strip them off so we can correctly
483+ // extract the file extension.
484+ std::map<std::string,std::string> args;
485+ std::string filename_stripped;
486+ if (! Strutil::get_rest_arguments (filename, filename_stripped, args)) {
487+ pvt::error (" ImageInput::create() called with malformed filename" );
488+ return nullptr ;
489+ }
490+
491+ if (filename_stripped.empty ())
492+ filename_stripped = filename;
493+
494+ if (filename_stripped.empty ()) { // Can't even guess if no filename given
482495 pvt::error (" ImageInput::create() called with no filename" );
483496 return NULL ;
484497 }
485498
486499 // Extract the file extension from the filename (without the leading dot)
487- std::string format = Filesystem::extension (filename , false );
500+ std::string format = Filesystem::extension (filename_stripped , false );
488501 if (format.empty ()) {
489502 // If the file had no extension, maybe it was itself the format name
490503 format = filename;
0 commit comments