diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-10-04 20:25:37 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-10-04 20:25:37 -0700 |
| commit | 0af38652da3b3be7da2d35b048285ef6f2194e1a (patch) | |
| tree | c43e871e406a11ad9ddca7f5af225f8e5e507000 /rt/lib/RT/URI.pm | |
| parent | a8e1cb65cd92239721b8e81ef9fdf99f60fb3c3c (diff) | |
| parent | 51b5bd15c154065a9a0f521565bd6187609c8348 (diff) | |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'rt/lib/RT/URI.pm')
| -rw-r--r-- | rt/lib/RT/URI.pm | 19 |
1 files changed, 19 insertions, 0 deletions
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 <URI> +Returns the canonical form of the given URI by calling L</FromURI> and then L</URI>. + +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 <Object> |
