Hyperlinks: Fix URL validation for https

This commit is contained in:
Roberto Fernandez Bautista 2022-08-27 22:45:19 +01:00
parent 122a6d7f46
commit f73a3f852e
1 changed files with 12 additions and 2 deletions

View File

@ -981,9 +981,19 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
bool EDA_TEXT::ValidateHyperlink( const wxString& aURL )
{
wxURL url;
if( aURL.IsEmpty() || IsGotoPageHref( aURL ) )
return true;
return aURL.IsEmpty() || url.SetURL( aURL ) == wxURL_NOERR || IsGotoPageHref( aURL );
// Limit valid urls to http and https for now. Note wxURL doesn't support https
wxURI uri;
if( uri.Create( aURL ) && uri.HasScheme() )
{
wxString scheme = uri.GetScheme();
return scheme == wxT( "http" ) || scheme == wxT( "https" );
}
return false;
}