Skip to content

Commit

Permalink
Fix for date checking on asset search (Bug #211)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregheo authored and theory committed Nov 5, 2010
1 parent af37917 commit fe25f92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/Bric/App/Callback/Search.pm
Expand Up @@ -308,9 +308,12 @@ sub _build_date_fields {

# check date fields
if ($v_start) {
eval('my $check_date = DateTime->new(year=>'.CORE::substr($v_start,0,4).
', month=>'.CORE::substr($v_start,5,2).
', day=>'.CORE::substr($v_start,8,2).')');
eval {
my $check_date = DateTime->new(
year => CORE::substr($v_start, 0, 4),
month => CORE::substr($v_start, 5, 2),
day => CORE::substr($v_start, 8, 2));
};
if ($@) {
$cb->raise_conflict(
'Invalid start date ' . CORE::substr($v_start, 0, 10) . " ($f)"
Expand All @@ -319,9 +322,12 @@ sub _build_date_fields {
}
}
if ($v_end) {
eval('my $check_date = DateTime->new(year=>'.CORE::substr($v_end,0,4).
', month=>'.CORE::substr($v_end,5,2).
', day=>'.CORE::substr($v_end,8,2).')');
eval {
my $check_date = DateTime->new(
year => CORE::substr($v_end, 0, 4),
month => CORE::substr($v_end, 5, 2),
day => CORE::substr($v_end, 8, 2));
};
if ($@) {
$cb->raise_conflict(
'Invalid end date ' . CORE::substr($v_end, 0, 10) . " ($f)"
Expand Down
5 changes: 5 additions & 0 deletions lib/Bric/Changes.pod
Expand Up @@ -109,6 +109,11 @@ preference setting (Bug #198). [Greg Heo]
The keyword autocomplete widget no longer suggests deleted keywords on the
story and media profiles (Bug #206). [Greg Heo]

=item *

Fixed a bug where some valid date ranges would be rejected as invalid when
searching for assets. (Bug #211). [David Oliveira]

=back

=head1 Version 2.0.0 (2010-04-12)
Expand Down

0 comments on commit fe25f92

Please sign in to comment.