Fix UTF-8 URL handling in dispatch. Added tests for creating assets and accessing assets with UTF-8 urls. Fixes bug #11785
This commit is contained in:
parent
67272517ce
commit
440df9879e
3 changed files with 24 additions and 6 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
- fixed #11782: Attachments all showing duplicated first thumbnail
|
- fixed #11782: Attachments all showing duplicated first thumbnail
|
||||||
- fixed #11777: Thingy search on yes no field fails
|
- fixed #11777: Thingy search on yes no field fails
|
||||||
- fixed #11787: Gallery resolutions wrongly ordered
|
- fixed #11787: Gallery resolutions wrongly ordered
|
||||||
|
- fixed #11785: Article title / URL with äÄöÖüÜ (reopen #11683)
|
||||||
|
|
||||||
7.9.12
|
7.9.12
|
||||||
- webgui.org homepage gives 404 (#11778)
|
- webgui.org homepage gives 404 (#11778)
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use LWP::MediaTypes qw(guess_media_type);
|
||||||
use Time::HiRes;
|
use Time::HiRes;
|
||||||
use WebGUI::Asset;
|
use WebGUI::Asset;
|
||||||
use WebGUI::PassiveAnalytics::Logging;
|
use WebGUI::PassiveAnalytics::Logging;
|
||||||
use URI;
|
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
@ -143,9 +142,7 @@ sub getUrlPermutations {
|
||||||
push @permutations, $url;
|
push @permutations, $url;
|
||||||
$url =~ s/\.\w+$//;
|
$url =~ s/\.\w+$//;
|
||||||
}
|
}
|
||||||
my $uri = URI->new($url);
|
my @fragments = split /\//, $url;
|
||||||
my @fragments = $uri->path_segments();
|
|
||||||
use Data::Dumper;
|
|
||||||
FRAG: while (@fragments) {
|
FRAG: while (@fragments) {
|
||||||
last FRAG if $fragments[-1] eq '';
|
last FRAG if $fragments[-1] eq '';
|
||||||
push @permutations, join "/", @fragments;
|
push @permutations, join "/", @fragments;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,11 @@ use strict;
|
||||||
use lib "$FindBin::Bin/../lib";
|
use lib "$FindBin::Bin/../lib";
|
||||||
use Test::More;
|
use Test::More;
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
|
use Data::Dumper;
|
||||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Content::Asset;
|
use WebGUI::Content::Asset;
|
||||||
|
use Encode;
|
||||||
|
|
||||||
my $output;
|
my $output;
|
||||||
|
|
||||||
|
|
@ -76,7 +78,15 @@ my $td
|
||||||
url => 'testdispatch',
|
url => 'testdispatch',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
diag $td->getId;
|
my $utf8_url = "viel-spa\x{00DF}";
|
||||||
|
utf8::upgrade $utf8_url;
|
||||||
|
my $utf8
|
||||||
|
= WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||||
|
title => "utf8",
|
||||||
|
className => 'WebGUI::Asset::TestDispatch',
|
||||||
|
url => $utf8_url,
|
||||||
|
} );
|
||||||
|
|
||||||
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -122,7 +132,11 @@ cmp_deeply(
|
||||||
[ '/one/two/three.rss', '/one/two/three', '/one/two', '/one', ],
|
[ '/one/two/three.rss', '/one/two/three', '/one/two', '/one', ],
|
||||||
".ext is a seperate URL permutation",
|
".ext is a seperate URL permutation",
|
||||||
);
|
);
|
||||||
|
cmp_deeply(
|
||||||
|
WebGUI::Content::Asset::getUrlPermutations( $utf8_url ),
|
||||||
|
[ $utf8_url ],
|
||||||
|
"UTF-8 handling for URLs",
|
||||||
|
);
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# test dispatch( session, url ) method
|
# test dispatch( session, url ) method
|
||||||
|
|
@ -132,6 +146,12 @@ is $output, "www_view one", "Regular www_view";
|
||||||
|
|
||||||
is $session->asset && $session->asset->getId, $td->getId, 'dispatch set the session asset';
|
is $session->asset && $session->asset->getId, $td->getId, 'dispatch set the session asset';
|
||||||
|
|
||||||
|
my $_asset = WebGUI::Asset->newByUrl($session, $utf8_url);
|
||||||
|
isa_ok $_asset, 'WebGUI::Asset::TestDispatch';
|
||||||
|
|
||||||
|
$output = WebGUI::Content::Asset::dispatch( $session, $utf8_url );
|
||||||
|
is $output, "www_view utf8", "dispatch for utf8 urls";
|
||||||
|
|
||||||
$output = WebGUI::Content::Asset::dispatch( $session, "testdispatch/foo" );
|
$output = WebGUI::Content::Asset::dispatch( $session, "testdispatch/foo" );
|
||||||
is $output, "bar", "special /foo handler";
|
is $output, "bar", "special /foo handler";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue