From 12628429d8553cf242a38f820187552b6fe93628 Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 15 Oct 2009 14:49:27 -0700 Subject: Fixed defect for URLs that already have a scheme See http://10.1.19.90:8080/go?page=ReviewDisplay&reviewid=18 --- indra/newview/llpanelmediasettingssecurity.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp index bdbc64e4b0..f5607aa287 100644 --- a/indra/newview/llpanelmediasettingssecurity.cpp +++ b/indra/newview/llpanelmediasettingssecurity.cpp @@ -236,16 +236,20 @@ void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in ) // white list list box widget and build a list to test against. Can also const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string& src_url ) { - // make sure the fragment has a scheme - const std::string default_scheme( "http://" ); - if ( src_url.find( default_scheme ) == std::string::npos ) - { + // use LLURI to determine if we have a valid scheme + LLURI candidate_url( src_url ); + if ( candidate_url.scheme().empty() ) + { + // build a URL comprised of default scheme and the original fragment + const std::string default_scheme( "http://" ); return default_scheme + src_url; - }; - - // TODO: probably other checks and defaults we can do here.. + }; + + // we *could* test the "default scheme" + "original fragment" URL again + // using LLURI to see if it's valid but I think the outcome is the same + // in either case - our only option is to return the original URL - // this is now a "valid" URL + // we *think* the original url passed in was valid return src_url; } -- cgit v1.2.3