X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FURI.pm;h=284a75ee0fdb065360a6d993a9663ca972c2263e;hb=0bff2e665b3a6389b47510e4c04a5a454f6dd7d4;hp=fce04598a4c666a8b1271bcea8482b6e6e3ace2c;hpb=806d426d106efea2b2b13314108c4ac046511e1c;p=freeside.git
diff --git a/rt/lib/RT/URI.pm b/rt/lib/RT/URI.pm
index fce04598a..284a75ee0 100644
--- a/rt/lib/RT/URI.pm
+++ b/rt/lib/RT/URI.pm
@@ -91,7 +91,26 @@ sub new {
return ($self);
}
+=head2 CanonicalizeURI
+Returns the canonical form of the given URI by calling L and then L.
+
+If the URI is unparseable by FromURI the passed in URI is simply returned untouched.
+
+=cut
+
+sub CanonicalizeURI {
+ my $self = shift;
+ my $uri = shift;
+ if ($self->FromURI($uri)) {
+ my $canonical = $self->URI;
+ if ($canonical and $uri ne $canonical) {
+ RT->Logger->debug("Canonicalizing URI '$uri' to '$canonical'");
+ $uri = $canonical;
+ }
+ }
+ return $uri;
+}
=head2 FromObject