From 46c253c57896da58a89e5270bd5368a1972c685f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=A4rter?= Date: Fri, 9 Aug 2024 13:50:03 +0200 Subject: [PATCH] Issue #3697: Replace \d with [0-9] in Kernel/GenericInterface. --- Kernel/GenericInterface/Event/Handler.pm | 4 ++-- .../Invoker/Elasticsearch/CustomerCompanyManagement.pm | 2 +- .../Invoker/Elasticsearch/CustomerUserManagement.pm | 2 +- .../Invoker/Elasticsearch/TicketManagement.pm | 6 +++--- Kernel/GenericInterface/Invoker/Test/TestSimple.pm | 2 +- Kernel/GenericInterface/Operation/Ticket/Common.pm | 4 ++-- Kernel/GenericInterface/Operation/Ticket/TicketSearch.pm | 2 +- Kernel/GenericInterface/Provider.pm | 2 +- Kernel/GenericInterface/Transport/HTTP/REST.pm | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Kernel/GenericInterface/Event/Handler.pm b/Kernel/GenericInterface/Event/Handler.pm index 59dfc0415..8c5073377 100644 --- a/Kernel/GenericInterface/Event/Handler.pm +++ b/Kernel/GenericInterface/Event/Handler.pm @@ -654,7 +654,7 @@ sub _ConditionCheck { next FIELDLNAME; } - my @ArrayFields = grep { $_ =~ m{ \A \Q$FieldName\E _ \d+ \z }xms } keys %{ $Param{Data} }; + my @ArrayFields = grep { $_ =~ m{ \A \Q$FieldName\E _ [0-9]+ \z }xms } keys %{ $Param{Data} }; if ( @ArrayFields && defined $ActualCondition->{Fields}->{$FieldName}->{Match} ) { ARRAYFIELD: @@ -866,7 +866,7 @@ sub _ConditionCheck { next FIELDLNAME; } - my @ArrayFields = grep { $_ =~ m{ \A \Q$FieldName\E _ \d+ \z }xms } keys %{ $Param{Data} }; + my @ArrayFields = grep { $_ =~ m{ \A \Q$FieldName\E _ [0-9]+ \z }xms } keys %{ $Param{Data} }; if ( @ArrayFields && defined $ActualCondition->{Fields}->{$FieldName}->{Match} ) { ARRAYFIELD: diff --git a/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerCompanyManagement.pm b/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerCompanyManagement.pm index 736928d2e..50e14cd20 100644 --- a/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerCompanyManagement.pm +++ b/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerCompanyManagement.pm @@ -303,7 +303,7 @@ sub HandleResponse { # fix ExecutrionTime param if ( $QueryParams{ExecutionTime} ) { - $QueryParams{ExecutionTime} =~ s{(\d+)\+(\d+)}{$1 $2}; + $QueryParams{ExecutionTime} =~ s{([0-9]+)\+([0-9]+)}{$1 $2}; } return { diff --git a/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerUserManagement.pm b/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerUserManagement.pm index 98a5bf4ad..2547b389e 100644 --- a/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerUserManagement.pm +++ b/Kernel/GenericInterface/Invoker/Elasticsearch/CustomerUserManagement.pm @@ -298,7 +298,7 @@ sub HandleResponse { # fix ExecutrionTime param if ( $QueryParams{ExecutionTime} ) { - $QueryParams{ExecutionTime} =~ s{(\d+)\+(\d+)}{$1 $2}; + $QueryParams{ExecutionTime} =~ s{([0-9]+)\+([0-9]+)}{$1 $2}; } return { diff --git a/Kernel/GenericInterface/Invoker/Elasticsearch/TicketManagement.pm b/Kernel/GenericInterface/Invoker/Elasticsearch/TicketManagement.pm index f4f7baf87..c5642393f 100644 --- a/Kernel/GenericInterface/Invoker/Elasticsearch/TicketManagement.pm +++ b/Kernel/GenericInterface/Invoker/Elasticsearch/TicketManagement.pm @@ -804,7 +804,7 @@ sub AssessResponse { $ResponseError = $ErrorMessage; } - if ( $ResponseCode !~ m{ \A 20 \d \z }xms ) { + if ( $ResponseCode !~ m{ \A 20 [0-9] \z }xms ) { $ResponseError = $ErrorMessage . " Response code '$ResponseCode'."; } @@ -863,7 +863,7 @@ sub HandleResponse { # fix ExecutionTime param if ( $QueryParams{ExecutionTime} ) { - $QueryParams{ExecutionTime} =~ s{(\d+)\+(\d+)}{$1 $2}; + $QueryParams{ExecutionTime} =~ s{([0-9]+)\+([0-9]+)}{$1 $2}; } return { @@ -885,7 +885,7 @@ sub HandleResponse { my $ArticleObject = $Kernel::OM->Get('Kernel::System::Ticket::Article'); # create the ticket - my ($TicketID) = $Param{Data}->{error}->{reason} =~ m/ \Q[_doc][\E (\d+) \Q]:\E \s /x; # e.g. "[_doc][5]: " + my ($TicketID) = $Param{Data}->{error}->{reason} =~ m/ \Q[_doc][\E ([0-9]+) \Q]:\E \s /x; # e.g. "[_doc][5]: " my $Errors = 0; if ( !$ESObject->TicketCreate( TicketID => $TicketID ) ) { $Errors++; diff --git a/Kernel/GenericInterface/Invoker/Test/TestSimple.pm b/Kernel/GenericInterface/Invoker/Test/TestSimple.pm index 2f728d6d7..38b37f873 100644 --- a/Kernel/GenericInterface/Invoker/Test/TestSimple.pm +++ b/Kernel/GenericInterface/Invoker/Test/TestSimple.pm @@ -138,7 +138,7 @@ sub HandleResponse { # fix ExecutrionTime param if ( $QueryParams{ExecutionTime} ) { - $QueryParams{ExecutionTime} =~ s{(\d+)\+(\d+)}{$1 $2}; + $QueryParams{ExecutionTime} =~ s{([0-9]+)\+([0-9]+)}{$1 $2}; } return { diff --git a/Kernel/GenericInterface/Operation/Ticket/Common.pm b/Kernel/GenericInterface/Operation/Ticket/Common.pm index 7fdda81da..1fd607993 100644 --- a/Kernel/GenericInterface/Operation/Ticket/Common.pm +++ b/Kernel/GenericInterface/Operation/Ticket/Common.pm @@ -779,7 +779,7 @@ sub ValidatePendingTime { # if only the Diff attribute is present, check if it's a valid number and return. # Nothing else needs to be checked in that case. if ( keys %{ $Param{PendingTime} } == 1 && defined $Param{PendingTime}->{Diff} ) { - return if $Param{PendingTime}->{Diff} !~ m{\A \d+ \z}msx; + return if $Param{PendingTime}->{Diff} !~ m{\A [0-9]+ \z}msx; return 1; } elsif ( defined $Param{PendingTime}->{Diff} ) { @@ -1146,7 +1146,7 @@ sub ValidateTimeUnit { return if !$Param{TimeUnit}; # TimeUnit must be positive - return if $Param{TimeUnit} !~ m{\A \d+([.,]\d+)? \z}xms; + return if $Param{TimeUnit} !~ m{\A [0-9]+([.,][0-9]+)? \z}xms; return 1; } diff --git a/Kernel/GenericInterface/Operation/Ticket/TicketSearch.pm b/Kernel/GenericInterface/Operation/Ticket/TicketSearch.pm index a32cd0298..ca1f71b6e 100644 --- a/Kernel/GenericInterface/Operation/Ticket/TicketSearch.pm +++ b/Kernel/GenericInterface/Operation/Ticket/TicketSearch.pm @@ -555,7 +555,7 @@ sub _GetDynamicFields { # Compatibility with older versions of the web service. for my $ParameterName ( sort keys %Param ) { - if ( $ParameterName =~ m{\A DynamicField_ ( [a-zA-Z\d\-]+ ) \z}xms ) { + if ( $ParameterName =~ m{\A DynamicField_ ( [a-zA-Z[0-9]\-]+ ) \z}xms ) { $DynamicFieldsRaw{$1} = $Param{$ParameterName}; } } diff --git a/Kernel/GenericInterface/Provider.pm b/Kernel/GenericInterface/Provider.pm index 1559386a4..7b5bc86c9 100644 --- a/Kernel/GenericInterface/Provider.pm +++ b/Kernel/GenericInterface/Provider.pm @@ -101,7 +101,7 @@ sub Content { if ( $RequestURI && - $RequestURI =~ m{ nph-genericinterface[.]pl/ (?: WebserviceID/ (? \d+ ) | Webservice/ (? [^/?]+ ) ) }smx + $RequestURI =~ m{ nph-genericinterface[.]pl/ (?: WebserviceID/ (? [0-9]+ ) | Webservice/ (? [^/?]+ ) ) }smx ) { %WebserviceGetData = ( diff --git a/Kernel/GenericInterface/Transport/HTTP/REST.pm b/Kernel/GenericInterface/Transport/HTTP/REST.pm index 32a7d0998..4710c97d7 100644 --- a/Kernel/GenericInterface/Transport/HTTP/REST.pm +++ b/Kernel/GenericInterface/Transport/HTTP/REST.pm @@ -707,7 +707,7 @@ sub RequesterPerformRequest { ErrorMessage => "'$Config->{Authentication}->{KerberosKeytab}' does not exist.", }; } - if ( $Config->{Authentication}->{KerberosUser} =~ /[^\w\d\-\._@]/ ) { + if ( $Config->{Authentication}->{KerberosUser} =~ /[^\w[0-9]\-\._@]/ ) { $Self->{DebuggerObject}->Error( Summary => "Invalid user format '$Config->{Authentication}->{KerberosUser}'.", ); @@ -1078,7 +1078,7 @@ sub _AssessResponse { $ResponseError = $ErrorMessage; } - if ( $ResponseCode !~ m{ \A 20 \d \z }xms ) { + if ( $ResponseCode !~ m{ \A 20 [0-9] \z }xms ) { $ResponseError = $ErrorMessage . " Response code '$ResponseCode'."; }