Skip to content

Commit

Permalink
Merge pull request #683 from mgcam/extend_validation_glob
Browse files Browse the repository at this point in the history
allow the dot character in QC outcomes database fields
  • Loading branch information
dkj authored May 6, 2020
2 parents 40fc5f5 + 130f67f commit 462b8bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/npg_qc/Schema/Mqc/OutcomeEntity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
7 changes: 5 additions & 2 deletions t/50-schema-result-UqcOutcomeEnt.t
Original file line number Diff line number Diff line change
Expand Up @@ -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/,
Expand All @@ -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 [email protected]') }
qr/Illegal characters/, 'email address is not allowed';
throws_ok { $p->sanitize_value('form <th>some</th>') }
qr/Illegal characters/, 'HTML is not allowed';
throws_ok { $p->sanitize_value('<script>console.log();</script>') }
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;

0 comments on commit 462b8bc

Please sign in to comment.