forward port slash handling fix from 7.4 branch

This commit is contained in:
Colin Kuskie 2008-02-14 23:51:17 +00:00
parent 10c435dccb
commit 39f1a3da3c
3 changed files with 20 additions and 3 deletions

View file

@ -13,6 +13,17 @@
a url to search the gallery for the keyword.
- add: Photos now track views
- fix: Multiple Gallery template fixes.
7.4.24
- fix: https and extra / in urls (perlDreamer Consulting, LLC.)
http://www.webgui.org/bugs/tracker/https-and-extra-/-in-urls
7.4.23
- fix: CalendarUpdateFeeds workflow causes errors in log
- autocommit for packages is handled by web method, not API method
- fix: importing packages generates orphaned duplicates of all attached storage locations
- fix: error rolling back version tags if a parent has a later revision date than its child
- show fields in tabs on DataForm default email template
- fix: don't show Admin mode toggle when not in adminModeSubnets
- fix regression: Site starter style displays incorrectly in IE
- really show fields in tabs on DataForm default email template

View file

@ -140,7 +140,7 @@ sub extras {
my $self = shift;
my $path = shift;
my $url = $self->session->config->get("extrasURL").'/'.$path;
$url =~ s$(?<!^http:)/{2,}$/$g; ##Remove //, unless it's part of http://
$url =~ s$(?<!:)/{2,}$/$g; ##Remove //, unless it's after a :, which can't be a valid URL character
return $url;
}

View file

@ -51,7 +51,7 @@ my @getRefererUrlTests = (
);
use Test::More;
plan tests => 58 + scalar(@getRefererUrlTests);
plan tests => 60 + scalar(@getRefererUrlTests);
my $session = WebGUI::Test->session;
@ -289,7 +289,13 @@ is($session->url->extras('/dir1//foo.html'), join('/', $extras,'dir1/foo.html'),
$extras = 'http://mydomain.com/';
$session->config->set('extrasURL', $extras);
is($session->url->extras('/foo.html'), join('', $extras,'foo.html'), 'extras method removes extra slashes');
is($session->url->extras('/foo.html'), join('', $extras,'foo.html'), 'extras method removes extra slashes');
is($session->url->extras('/dir1//foo.html'), join('', $extras,'dir1/foo.html'), 'extras method removes extra slashes anywhere');
$extras = 'https://mydomain.com/';
$session->config->set('extrasURL', $extras);
is($session->url->extras('/foo.html'), join('', $extras,'foo.html'), 'extras method removes extra slashes');
is($session->url->extras('/dir1//foo.html'), join('', $extras,'dir1/foo.html'), 'extras method removes extra slashes anywhere');
$session->config->set('extrasURL', $origExtras);