[Rt-commit] r13931 - in rtfm/trunk: .

falcone at bestpractical.com falcone at bestpractical.com
Wed Jul 9 16:45:56 EDT 2008


Author: falcone
Date: Wed Jul  9 16:45:56 2008
New Revision: 13931

Modified:
   rtfm/trunk/   (props changed)
   rtfm/trunk/lib/RT/FM/Article_Overlay.pm

Log:
 r35345 at ketch:  falcone | 2008-07-09 16:45:35 -0400
 * steal some of Ticket's URI checking so we don't accept as many
   garbage inputs


Modified: rtfm/trunk/lib/RT/FM/Article_Overlay.pm
==============================================================================
--- rtfm/trunk/lib/RT/FM/Article_Overlay.pm	(original)
+++ rtfm/trunk/lib/RT/FM/Article_Overlay.pm	Wed Jul  9 16:45:56 2008
@@ -387,9 +387,19 @@
     # allowed, they default to being tickets instead of articles, which
     # is counterintuitive.
     if ($args{'Target'} =~ /^\d+$/) {
-	return ( 0, $self->loc("Cannot add link to plain number") );
+        return ( 0, $self->loc("Cannot add link to plain number") );
     }
 
+    # Check that we're actually getting a valid URI
+    my $uri_obj = RT::URI->new( $self->CurrentUser );
+    $uri_obj->FromURI( $args{'Target'} );
+    unless ( $uri_obj->Resolver && $uri_obj->Scheme ) {
+        my $msg = $self->loc( "Couldn't resolve '[_1]' into a Link.", $args{'Target'} );
+        $RT::Logger->warning( $msg );
+        return( 0, $msg );
+    }
+
+
     $self->_AddLink(%args);
 }
 


More information about the Rt-commit mailing list