fixing handling of http:// calls in the Extras URL
This commit is contained in:
parent
21658d2ffd
commit
72906e27fb
3 changed files with 27 additions and 11 deletions
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
7.4.17
|
7.4.17
|
||||||
- fix: double width characters encoded incorrectly in Collaboration RSS feed
|
- fix: double width characters encoded incorrectly in Collaboration RSS feed
|
||||||
|
- fix: ExtrasUrl in conf http:// stripping / from URL (perlDreamer Consulting, LLC.)
|
||||||
|
http://www.plainblack.com/bugs/tracker/extrasurl-in-conf-http/-stripping-/-from-url
|
||||||
|
|
||||||
7.4.16
|
7.4.16
|
||||||
- fix: Event End Time Missing (perlDreamer Consulting, LLC.)
|
- fix: Event End Time Missing (perlDreamer Consulting, LLC.)
|
||||||
|
|
|
||||||
|
|
@ -130,16 +130,18 @@ Combinds the base extrasURL defined in the config file with a specfied path.
|
||||||
|
|
||||||
=head3 path
|
=head3 path
|
||||||
|
|
||||||
The path to the thing in the extras folder that you're referencing. Note that the leading / is not necessary. Multiple consecutive slashes will be replaced with a single slash.
|
The path to the thing in the extras folder that you're
|
||||||
|
referencing. Note that the leading / is not necessary. Multiple
|
||||||
|
consecutive slashes in the path part of the URL will be replaced with a single slash.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub extras {
|
sub extras {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $path = shift;
|
my $path = shift;
|
||||||
my $url = $self->session->config->get("extrasURL").'/'.$path;
|
my $url = $self->session->config->get("extrasURL").'/'.$path;
|
||||||
$url =~ s!/+!/!g;
|
$url =~ s$(?<!^http:)/{2,}$/$g;
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ my @getRefererUrlTests = (
|
||||||
);
|
);
|
||||||
|
|
||||||
use Test::More;
|
use Test::More;
|
||||||
plan tests => 56 + scalar(@getRefererUrlTests);
|
plan tests => 58 + scalar(@getRefererUrlTests);
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
|
|
@ -278,10 +278,21 @@ is($session->url->makeAbsolute('page1'), '/page1', 'makeAbsolute: default baseUr
|
||||||
#
|
#
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
is($session->url->extras, $session->config->get('extrasURL').'/', 'extras method returns URL to extras with a trailing slash');
|
my $origExtras = $session->config->get('extrasURL');
|
||||||
is($session->url->extras('foo.html'), join('/', $session->config->get('extrasURL'),'foo.html'), 'extras method appends to the extras url');
|
my $extras = $origExtras;
|
||||||
is($session->url->extras('/foo.html'), join('/', $session->config->get('extrasURL'),'foo.html'), 'extras method removes extra slashes');
|
|
||||||
is($session->url->extras('/dir1//foo.html'), join('/', $session->config->get('extrasURL'),'dir1/foo.html'), 'extras method removes extra slashes anywhere');
|
is($session->url->extras, $extras.'/', 'extras method returns URL to extras with a trailing slash');
|
||||||
|
is($session->url->extras('foo.html'), join('/', $extras,'foo.html'), 'extras method appends to the extras url');
|
||||||
|
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 = '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('/dir1//foo.html'), join('', $extras,'dir1/foo.html'), 'extras method removes extra slashes anywhere');
|
||||||
|
|
||||||
|
$session->config->set('extrasURL', $origExtras);
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
#
|
#
|
||||||
|
|
@ -387,6 +398,7 @@ END { ##Always clean-up
|
||||||
$session->setting->set('hostToUse', $setting_hostToUse);
|
$session->setting->set('hostToUse', $setting_hostToUse);
|
||||||
$session->setting->set('preventProxyCache', $preventProxyCache);
|
$session->setting->set('preventProxyCache', $preventProxyCache);
|
||||||
$session->config->set('gateway', $gateway);
|
$session->config->set('gateway', $gateway);
|
||||||
|
$session->config->set('extrasURL', $origExtras);
|
||||||
|
|
||||||
if ($config_port) {
|
if ($config_port) {
|
||||||
$session->config->set($config_port);
|
$session->config->set($config_port);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue