Commit 583aed31 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fix up date parsing and insertion in PostHistoryRecord().

parent e65166fa
...@@ -1049,12 +1049,13 @@ sub PostHistoryRecord($) ...@@ -1049,12 +1049,13 @@ sub PostHistoryRecord($)
$record->{$slot} = $date; $record->{$slot} = $date;
} }
# Leave dates as GMT # Leave dates as GMT but confirm it is parsable as a date.
if (! ($date =~ /^[-\w:.\/]+/)) { my $parsed_date = str2time($date);
if (!defined($parsed_date)) {
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef, return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Improper date format: $slot"); "Could not parse $slot: $date");
} }
push(@insert_data, "$slot=" . DBQuoteSpecial($date)); push(@insert_data, "$slot=FROM_UNIXTIME($parsed_date)");
} }
# Only toplevel aggregates # Only toplevel aggregates
if (! (defined($record->{'type'}) && $record->{'type'} eq "Aggregate")) { if (! (defined($record->{'type'}) && $record->{'type'} eq "Aggregate")) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment