diff --git a/pcbnew/import_gfx/graphics_import_mgr.cpp b/pcbnew/import_gfx/graphics_import_mgr.cpp index 532e52b066..f38711f431 100644 --- a/pcbnew/import_gfx/graphics_import_mgr.cpp +++ b/pcbnew/import_gfx/graphics_import_mgr.cpp @@ -27,6 +27,7 @@ #include "dxf_import_plugin.h" #include "svg_import_plugin.h" +#include GRAPHICS_IMPORT_MGR::GRAPHICS_IMPORT_MGR( const TYPE_LIST& aBlacklist ) { @@ -71,10 +72,12 @@ std::unique_ptr GRAPHICS_IMPORT_MGR::GetPluginByExt( for( const auto& fileExt : fileExtensions ) { - if( aExtension.IsSameAs( fileExt, false ) ) + wxRegEx extensions( fileExt, wxRE_BASIC ); + + if( extensions.Matches( aExtension ) ) return plugin; } } return {}; -} \ No newline at end of file +} diff --git a/qa/pcbnew/test_graphics_import_mgr.cpp b/qa/pcbnew/test_graphics_import_mgr.cpp index ac6891cae2..bec3a75de7 100644 --- a/qa/pcbnew/test_graphics_import_mgr.cpp +++ b/qa/pcbnew/test_graphics_import_mgr.cpp @@ -29,6 +29,8 @@ #include #include +#include + /** * Declares a struct as the Boost test fixture. */ @@ -38,7 +40,15 @@ static bool pluginHandlesExt( const GRAPHICS_IMPORT_PLUGIN& aPlugin, const std:: { const auto exts = aPlugin.GetFileExtensions(); - return std::find( exts.begin(), exts.end(), wxString( aExt ) ) != exts.end(); + for( auto ext : exts ) + { + std::regex ext_reg( ext.ToStdString() ); + + if( std::regex_match( aExt, ext_reg ) ) + return true; + } + + return false; } struct TYPE_TO_EXTS