Permalink
Browse files

make image_by_name case-insensitive

  • Loading branch information...
1 parent fb40043 commit e1d80b8dbfb4229ee23ac7996be4a0239e3ecb28 @tonycoz committed Mar 19, 2013
Showing with 4 additions and 4 deletions.
  1. +3 −3 site/cgi-bin/modules/BSE/TB/SiteCommon.pm
  2. +1 −1 t/050-local/010-api.t
@@ -2,7 +2,7 @@ package BSE::TB::SiteCommon;
use strict;
use Carp qw(confess);
-our $VERSION = "1.009";
+our $VERSION = "1.010";
=head1 NAME
@@ -183,11 +183,11 @@ sub image_by_name {
unless ($self->{_images_by_name}) {
$self->{_images_by_name} =
+{
- map { $_->name => $_ } grep $_->name, $self->images
+ map { lc $_->name => $_ } grep $_->name, $self->images
};
}
- my $image = $self->{_images_by_name}{$name}
+ my $image = $self->{_images_by_name}{lc $name}
or return;
return $image;
View
@@ -237,7 +237,7 @@ undef $art;
is($mine[2]->displayOrder, $im3->displayOrder, "last should be last");
# fetch by name
- my $named = $site->image_by_name($prefix . "a");
+ my $named = $site->image_by_name($prefix . "A");
is($named->id, $im3->id, "check we got the right image by name");
# fetch by index

0 comments on commit e1d80b8

Please sign in to comment.