From: Anthony Geay Date: Fri, 10 Sep 2021 13:23:36 +0000 (+0200) Subject: Allow EDF URL style X-Git-Tag: V9_8_0a1~2^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd19f3d3154d885b365ecad903bb9f6b31cb0a4a;p=modules%2Fsmesh.git Allow EDF URL style --- diff --git a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx index e1d2db8d2..99336c6a3 100644 --- a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx +++ b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx @@ -197,17 +197,32 @@ namespace bool isURL( LibraryFile & libraryFile ) { - enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings - std::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)", - std::regex::extended ); - std::smatch matchResult; - - libraryFile._isURL = false; - if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) - libraryFile._isURL = ( !matchResult.str( SCHEME ).empty() && - !matchResult.str( AUTHORITY ).empty() && - !matchResult.str( PATH ).empty() ); - + {// round1 + enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings + std::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)", + std::regex::extended ); + std::smatch matchResult; + + libraryFile._isURL = false; + if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) + libraryFile._isURL = ( !matchResult.str( SCHEME ).empty() && + !matchResult.str( AUTHORITY ).empty() && + !matchResult.str( PATH ).empty() ); + } + if(libraryFile._isURL) + return true; + {// round2 + enum { HOST = 2, PORT = 3, PATH = 4 }; // sub-strings + std::regex urlRegex ( R"(^(([^:\/?#]+):)?([^/]+)?(/[^#]*))", + std::regex::extended ); + std::smatch matchResult; + + libraryFile._isURL = false; + if ( std::regex_match( libraryFile._name, matchResult, urlRegex )) + libraryFile._isURL = ( !matchResult.str( HOST ).empty() && + !matchResult.str( PORT ).empty() && + !matchResult.str( PATH ).empty() ); + } return libraryFile._isURL; }