Skip to content

Commit 032d3e8

Browse files
AdamMainsTLlgritz
authored andcommitted
fix: Only check REST arguments if the file does not exist (AcademySoftwareFoundation#4085)
Fix for AcademySoftwareFoundation#4084. Will now check if the given filename exists before checking for REST parameters. Before: ``` bin % ./oiiotool \?.png -o \?-output.png oiiotool ERROR: read : "?.png": ImageInput::create() called with malformed filename Full command line was: > oiiotool ?.png -o ?-output.png ``` After: ``` bin % ./oiiotool \?.png -o \?-output.png ``` No output, `?-output.png` created. Signed-off-by: AdamMainsTL <[email protected]>
1 parent f23b6c7 commit 032d3e8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/libOpenImageIO/imageioplugin.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,14 @@ ImageInput::create(string_view filename, bool do_open, const ImageSpec* config,
649649
std::unique_ptr<ImageInput> in;
650650
std::map<std::string, std::string> args;
651651
std::string filename_stripped;
652-
if (!Strutil::get_rest_arguments(filename, filename_stripped, args)) {
653-
OIIO::pvt::errorfmt(
654-
"ImageInput::create() called with malformed filename");
655-
return in;
652+
653+
// Only check REST arguments if the file does not exist
654+
if (!Filesystem::exists(filename)) {
655+
if (!Strutil::get_rest_arguments(filename, filename_stripped, args)) {
656+
OIIO::pvt::errorfmt(
657+
"ImageInput::create() called with malformed filename");
658+
return in;
659+
}
656660
}
657661

658662
if (filename_stripped.empty())

0 commit comments

Comments
 (0)