diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-10-17 15:57:57 +0200 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-10-17 15:57:57 +0200 |
commit | 62ae33ffa16c22e9705bd22e48fb8299225462f4 (patch) | |
tree | 0571fb266d0b0c619d9be2a8c2272d04afcce9a1 /attachment.cgi | |
parent | 2c257b0a104c1bb3483adfb0eacb792c528010e9 (diff) | |
parent | 7355bd53bc4b20e248550e5467142a79e9512fbc (diff) | |
download | bugzilla-62ae33ffa16c22e9705bd22e48fb8299225462f4.tar.gz bugzilla-62ae33ffa16c22e9705bd22e48fb8299225462f4.tar.xz |
merged with bugzilla/4.2
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-x | attachment.cgi | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/attachment.cgi b/attachment.cgi index 95d793e75..57706d5e0 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -680,20 +680,23 @@ sub update { $attachment->set_filename(scalar $cgi->param('filename')); # Now make sure the attachment has not been edited since we loaded the page. - if (defined $cgi->param('delta_ts') - && $cgi->param('delta_ts') ne $attachment->modification_time) - { - ($vars->{'operations'}) = - Bugzilla::Bug::GetBugActivity($bug->id, $attachment->id, $cgi->param('delta_ts')); + my $delta_ts = $cgi->param('delta_ts'); + my $modification_time = $attachment->modification_time; - # The token contains the old modification_time. We need a new one. - $cgi->param('token', issue_hash_token([$attachment->id, $attachment->modification_time])); + if ($delta_ts && $delta_ts ne $modification_time) { + datetime_from($delta_ts) + or ThrowCodeError('invalid_timestamp', { timestamp => $delta_ts }); + ($vars->{'operations'}) = + Bugzilla::Bug::GetBugActivity($bug->id, $attachment->id, $delta_ts); # If the modification date changed but there is no entry in # the activity table, this means someone commented only. # In this case, there is no reason to midair. if (scalar(@{$vars->{'operations'}})) { - $cgi->param('delta_ts', $attachment->modification_time); + $cgi->param('delta_ts', $modification_time); + # The token contains the old modification_time. We need a new one. + $cgi->param('token', issue_hash_token([$attachment->id, $modification_time])); + $vars->{'attachment'} = $attachment; print $cgi->header(); |