Skip to content

Commit 042cb5a

Browse files
committed
Reject invalid priority labels in SetPriority
SetPriority converts its argument to a number before storing, so a value that was neither a number nor a configured PriorityAsString label was silently coerced to 0. The web forms use numeric inputs, but other callers (the REST2 API, the CLI, scrips) could still zero out a priority with a bad value. Return an error and leave the priority unchanged instead.
1 parent 6d80548 commit 042cb5a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/RT/Ticket.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3379,9 +3379,10 @@ sub SetPriority {
33793379
else {
33803380
# Try to load a number from the string
33813381
$number = $self->_PriorityAsNumber($priority);
3382+
return ( 0, $self->loc( "Invalid value for [_1]", $self->loc("Priority") ) ) unless defined $number;
33823383
}
33833384

3384-
return $self->_Set( Field => 'Priority', Value => $number || 0 );
3385+
return $self->_Set( Field => 'Priority', Value => $number );
33853386
}
33863387

33873388
=head2 TimeEstimated

0 commit comments

Comments
 (0)