From 130f67f2ad3364c0ca5809f3c8cfad8b50537384 Mon Sep 17 00:00:00 2001 From: Marina Gourtovaia Date: Wed, 6 May 2020 16:02:17 +0100 Subject: [PATCH] allow the dot character in QC outcomes database fields --- Changes | 3 +++ lib/npg_qc/Schema/Mqc/OutcomeEntity.pm | 2 +- t/50-schema-result-UqcOutcomeEnt.t | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index f32dbd68a..3b6620295 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ LIST OF CHANGES FOR NPG-QC PACKAGE +release 68.2.1 + - allow the dot character in QC outcomes column values + release 68.2.0 - tweak for genome coverage figure in qc summary - fall back to target if no default autosomes only number available. diff --git a/lib/npg_qc/Schema/Mqc/OutcomeEntity.pm b/lib/npg_qc/Schema/Mqc/OutcomeEntity.pm index 01431f15c..062a46f0e 100644 --- a/lib/npg_qc/Schema/Mqc/OutcomeEntity.pm +++ b/lib/npg_qc/Schema/Mqc/OutcomeEntity.pm @@ -173,7 +173,7 @@ sub sanitize_value { $value =~ s/\A\s+//smx; $value =~ s/\s+\Z//smx; $value or croak q[Only white space characters in input]; - ($value =~ /\A[[:word:][:space:]#-]+\Z/smx) or croak qq[Illegal characters in $value]; + ($value =~ /\A[[:word:][:space:].#-]+\Z/smx) or croak qq[Illegal characters in '$value']; return $value; } diff --git a/t/50-schema-result-UqcOutcomeEnt.t b/t/50-schema-result-UqcOutcomeEnt.t index 54897e6a5..168740ded 100644 --- a/t/50-schema-result-UqcOutcomeEnt.t +++ b/t/50-schema-result-UqcOutcomeEnt.t @@ -293,7 +293,7 @@ subtest 'update outcome' => sub { }; subtest 'sanitize' => sub { - plan tests => 14; + plan tests => 16; my $p = 'npg_qc::Schema::Result::UqcOutcomeEnt'; throws_ok { $p->sanitize_value() } qr/Input undefined/, @@ -316,13 +316,16 @@ subtest 'sanitize' => sub { qr/Illegal characters/, 'double quotes are not accepted'; throws_ok { $p->sanitize_value(q{email someone's friend}) } qr/Illegal characters/, 'single quotes are not accepted'; - + lives_ok { $p->sanitize_value(q{email someone#s friend}) } + 'hashes are accepted'; throws_ok { $p->sanitize_value('email some@other.com') } qr/Illegal characters/, 'email address is not allowed'; throws_ok { $p->sanitize_value('form some') } qr/Illegal characters/, 'HTML is not allowed'; throws_ok { $p->sanitize_value('') } qr/Illegal characters/, 'JavaScript is not allowed'; + lives_ok { $p->sanitize_value('robo_qc 68.2.0 artic-qc') } + 'standard rationale for uqc is OK'; }; 1;