[Rt-commit] r19593 - rt/3.8/trunk/lib/RT

sartak at bestpractical.com sartak at bestpractical.com
Fri May 8 16:37:24 EDT 2009


Author: sartak
Date: Fri May  8 16:37:24 2009
New Revision: 19593

Modified:
   rt/3.8/trunk/lib/RT/ObjectCustomFieldValue_Overlay.pm

Log:
URI-escape placeholders for OCFV->FillInTemplateURL

Modified: rt/3.8/trunk/lib/RT/ObjectCustomFieldValue_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/ObjectCustomFieldValue_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/ObjectCustomFieldValue_Overlay.pm	Fri May  8 16:37:24 2009
@@ -50,6 +50,8 @@
 
 use strict;
 use warnings;
+use RT::Interface::Web;
+
 no warnings qw(redefine);
 
 sub Create {
@@ -195,7 +197,7 @@
 =head2 _FillInTemplateURL URL
 
 Takes a URL containing placeholders and returns the URL as filled in for this 
-ObjectCustomFieldValue.
+ObjectCustomFieldValue. The values for the placeholders will be URI-escaped.
 
 Available placeholders:
 
@@ -214,15 +216,19 @@
 =cut
 
 sub _FillInTemplateURL {
-
     my $self = shift;
-
     my $url = shift;
 
+    my $id = $self->ObjectId;
     my $content = join '', @{[$self->Content]};
-    $content = '' if !defined($content);
 
-    $url =~ s/__id__/$self->ObjectId/eg;
+    # default value, uri-escape
+    for ($id, $content) {
+        $_ = '' if !defined($_);
+        RT::Interface::Web::EscapeURI(\$_);
+    }
+
+    $url =~ s/__id__/$id/g;
     $url =~ s/__CustomField__/$content/g;
 
     return $url;


More information about the Rt-commit mailing list