diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm index 68231c8d4..1a98375b3 100644 --- a/lib/WebGUI/AssetExportHtml.pm +++ b/lib/WebGUI/AssetExportHtml.pm @@ -219,27 +219,27 @@ sub exportAsHtml { # verify them if(!defined $userId) { $returnCode = 0; - $message = 'need a userId parameter'; + $message = $i18n->get('need a userId parameter'); return ($returnCode, $message); } # we take either a numeric userId or a WebGUI::User object if( ref $userId ne 'WebGUI::User' && ! (looks_like_number($userId) || $session->id->valid($userId))) { $returnCode = 0; - $message = "'$userId' is not a valid userId"; + $message = "'$userId' ".$i18n->get('is not a valid userId'); return ($returnCode, $message); } # depth is required. if(!defined $depth) { $returnCode = 0; - $message = 'need a depth'; + $message = $i18n->get('need a depth'); return ($returnCode, $message); } # and it must be a number. if( !looks_like_number($depth) ) { $returnCode = 0; - $message = "'$depth' is not a valid depth"; + $message = sprintf $i18n->get('%d is not a valid depth'), $depth; return ($returnCode, $message); } diff --git a/lib/WebGUI/International.pm b/lib/WebGUI/International.pm index 20a1f737b..ea48c70e1 100644 --- a/lib/WebGUI/International.pm +++ b/lib/WebGUI/International.pm @@ -94,7 +94,7 @@ A string that specifies the language that the user should see. Defaults to the =cut -my $safeRe = qr/[^\.\w\d\s\/\^\;\?]/; +my $safeRe = qr/[^\.\w\d\s\/\^\;\?%]/; sub get { my ($self, $id, $namespace, $language) = @_; diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm index 3540bb2b2..1592144ed 100644 --- a/lib/WebGUI/i18n/English/Asset.pm +++ b/lib/WebGUI/i18n/English/Asset.pm @@ -1127,6 +1127,30 @@ Couldn't open %-s because %-s
context => q{Error message in Asset.pm}, } + 'need a userId parameter' => { + message => q{need a userId parameter}, + lastUpdated => 0, + context => q{Error message in exportAsHtml for an illegal parameter.}, + }, + + 'is not a valid userId' => { + message => q{is not a valid userId}, + lastUpdated => 0, + context => q{Error message in exportAsHtml for an illegal parameter.}, + }, + + 'need a depth' => { + message => q{need a depth}, + lastUpdated => 0, + context => q{Error message in exportAsHtml for an illegal parameter.}, + }, + + '%s is not a valid depth' => { + message => q{%s is not a valid depth}, + lastUpdated => 0, + context => q{Error message in exportAsHtml for an illegal parameter.}, + }, + }; 1; diff --git a/t/Asset/AssetExportHtml.t b/t/Asset/AssetExportHtml.t index a5fba250b..4e2d203e9 100644 --- a/t/Asset/AssetExportHtml.t +++ b/t/Asset/AssetExportHtml.t @@ -725,7 +725,7 @@ is($message, "need a depth", "exportAsHtml returns correct message when not give ($success, $message) = $home->exportAsHtml( { userId => 3, depth => 'orly? yarly!' } ); is($success, 0, "exportAsHtml returns 0 when given bogus, memetic depth"); -is($message, "'orly? yarly!' is not a valid depth", "exportAsHtml returns correct message when given bogus, memetic depth"); +is($message, "orly? yarly! is not a valid depth", "exportAsHtml returns correct message when given bogus, memetic depth"); # next, let's make sure some simple exports work. export 'home', but clean up # the exportPath first to make sure there are no residuals from the tests