Skip to content
Permalink
Browse files

- fixed #12365: editing a metadata category may cause a fatal error

  • Loading branch information...
arjancwidlak committed Jun 5, 2012
1 parent 8370cb1 commit 7ab47266003171c3872bd512828a541b56b402e5
Showing with 19 additions and 2 deletions.
  1. +1 −0 docs/changelog/7.x.x.txt
  2. +2 −1 lib/WebGUI/AssetMetaData.pm
  3. +16 −1 t/Asset/AssetMetaData.t
@@ -1,4 +1,5 @@
7.10.25
- fixed #12365: editing a metadata may cause a fatal error (Arjan Widlak / United Knowledge)
- fixed #12346: toVersion in upgrade_7.9.34-7.10.22.pl was "0.0.0"
- fixed #12010 related link duplication where links have group view restrictions
- fixed #12297: keywords.form missing from Post template help
@@ -388,6 +388,7 @@ sub www_editMetaDataField {
my %usedNames;
for my $class (WebGUI::Pluggable::findAndLoad('WebGUI::Asset')) {
next unless $class->isa('WebGUI::Asset');
next unless isIn( $class, keys %{ $self->session->config->get("assets") } );
my $name = $class->definition($self->session)->[0]->{assetName};
next unless $name; # abstract classes (e.g. wobject) don't have names

@@ -480,7 +481,7 @@ sub www_editMetaDataFieldSave {

#-------------------------------------------------------------------

=head2 www_manageMetaData ( )
=head2 www_manageMetaData ( )n
Returns an AdminConsole to deal with MetaDataFields. If isInGroup(4) is False, renders an insufficient privilege page.
@@ -24,7 +24,7 @@ use WebGUI::VersionTag;

use Test::More; # increment this value for each test you create
use Test::Deep;
plan tests => 16;
plan tests => 17;

my $session = WebGUI::Test->session;
$session->user({userId => 3});
@@ -305,6 +305,21 @@ subtest 'asset metadata versioning' => sub {
is $count_all->($dup), 1, 'one value for dup';
};

# Check that www_editMetaDataField doesn't return assets that are not configured
# for this site and that sub definition is not executed if the asset is not
# configured in the config, which may cause a fatal error.

# Temporarily remove asset Article from config
$session->config->deleteFromHash( 'assets', 'WebGUI::Asset::Wobject::Article' );
unlike(
my $got = $root->www_editMetaDataField(),
qr/WebGUI::Asset::Wobject::Article/,
'article was (temporarily) not in config and should not appear in form'
);
# Restore config:
$session->config->addToHash( 'assets', 'WebGUI::Asset::Wobject::Article' );


sub buildNameIndex {
my ($fidStruct) = @_;
my $nameStruct;

0 comments on commit 7ab4726

Please sign in to comment.
You can’t perform that action at this time.