[Rt-commit] rt branch 5.0/rest2-validate-input-on-ticket-update created. rt-5.0.2-37-g8d963c1214

BPS Git Server git at git.bestpractical.com
Mon Nov 22 18:08:56 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/rest2-validate-input-on-ticket-update has been created
        at  8d963c1214e3ae8dbdda90ba0bca32c46b989633 (commit)

- Log -----------------------------------------------------------------
commit 8d963c1214e3ae8dbdda90ba0bca32c46b989633
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 23 01:50:37 2021 +0800

    Add the missing validate_input call for REST2 ticket update
    
    This is ported from RT-Extension-REST2 and was supposed to be included
    in df5092aa75, but got dropped probably because of conflicts.

diff --git a/lib/RT/REST2/Resource/Ticket.pm b/lib/RT/REST2/Resource/Ticket.pm
index 5caff4709f..631b15fc66 100644
--- a/lib/RT/REST2/Resource/Ticket.pm
+++ b/lib/RT/REST2/Resource/Ticket.pm
@@ -125,6 +125,13 @@ sub update_record {
     my $self = shift;
     my $data = shift;
 
+    my ($ok, $msg, $return_code) = $self->validate_input(Data => $data, Action => 'update');
+
+    # XXX TODO: refactor update_resource to accept return_code in response
+    if (!$ok) {
+        return (0, $msg);
+    }
+
     my @results;
 
     if ( my $action = $self->action ) {

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list