S3/Types.pm

filter: Statementstmt 100% 13 / 13 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 95.4% 21 / 22 CC 3 SCAR 4.8
CC
3
Cov
94%
__ANON__
2.1
__ANON__
2.0
BEGIN
1.0
CRAP 1.6
« S3/HTTPRequest.pm ↑ Summary S3/Request/GetPreSignedUrl.pm »
1  
2 package AWS::S3::Types;
3  
4 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # The name of a bucket is interpolated into the host (and sometimes the path)
10 # of every request we make, so it must not be able to change the structure of
11 # the URL: no "/", "?", "#", "@", ":", "%", whitespace and so on, otherwise
12 # the (signed) request, including any session token, could be sent to an
13 # arbitrary host or be turned into a different S3 operation.
14 #
15 # This is deliberately more permissive than the current S3 naming rules (no
16 # lowercase only restriction, underscores and up to 255 characters allowed)
17 # as legacy buckets and S3 compatible stores still use such names.
18 #
19 # Note \z rather than $, the latter would allow a trailing newline.
20 subtype 'AWS::S3::BucketName',
21 as 'Str',
22 489 ▶ where {
Subroutine __ANON__: called CC=2 SCAR=6.9
23 489 ▶ length( $_ ) <= 255
Branch: 1 branch
BranchTrueFalseTotal
length $_ <= 255 and $_ =~ /\A[A-Za-z0-9][A-Za-z0-9._-]*\z/ 474 15 489
24 && $_ =~ /\A[A-Za-z0-9][A-Za-z0-9._-]*\z/
25 },
26 253 ▶ message {
Subroutine __ANON__: called CC=2 SCAR=7.6
27 253 ▶ "Invalid S3 bucket name '" . ( defined $_ ? $_ : 'undef' ) . "'"
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 253 0 253
28 9 };
29  
30 9 1;
« S3/HTTPRequest.pm ↑ Summary S3/Request/GetPreSignedUrl.pm »