Branch Coverage

blib/lib/Mojolicious/Static.pm
Criterion Covered Total %
branch 72 74 97.3


line true false branch
23 1 19 unless $asset =~ m[^/]u
34 155 938 unless $method eq "GET" or $method eq "HEAD"
39 62 876 $stash->{'path'} ? :
40 83 855 unless my(@parts) = @{$path->canonicalize->parts;}
44 784 71 if $canon_path =~ m[^\.\./|\\]u or not $self->serve($c, $canon_path)
48 7 64 if $c->app->mode eq "development" and index($canon_path, $self->asset_dir) == 0
57 43 809 unless $self->{'index'}
62 813 44 unless my $asset = _get_file(path($path, @parts)->to_string)
67 18 790 if (my $asset = $self->_get_data_file($rel))
71 16 774 exists $extra->{$rel} ? :
76 45 357 unless $file =~ m[^/]u
77 348 54 unless my $prefix = $self->prefix
86 83 18 if $last
87 3 89 $etag =~ m[^W/"]u ? :
92 9 if $etag
92 80 21 unless my $since = $req_headers->if_modified_since or $match
96 14 9 unless $_ eq $etag
4 17 if $match and not grep({"W/$_" eq $etag unless $_ eq $etag;} map({trim($_);} split(/,/u, $match, 0)))
99 11 6 unless $last //= $res_headers->last_modified and $since
107 11 843 if (my $prefix = $self->prefix)
109 5 6 unless $rel =~ s[^\Q$prefix\E/][]u
112 772 77 unless my $asset = $self->file($rel)
121 60 21 if $asset->is_file
128 3 78 if $self->is_fresh($c, $options)
131 61 17 unless my $range = $c->req->headers->range
134 1 16 unless my $size = $asset->size
135 0 16 unless $range =~ /^bytes=(\d+)?-(\d+)?/u
136 11 5 defined $2 && $2 < $size ? :
137 3 13 if $start > $end
156 40 44 unless -d $asset_path
163 44 264 unless $filename =~ /^([^.]+)\.([^.]+)\.(.+)$/u
165 88 176 $prefix eq '' ? :
168 264 0 if not exists $assets->{$short} or $checksum eq "development"
179 712 96 if not $rel =~ /\.\w+$/u or $rel =~ /\.\w+\.\w+$/u
183 78 18 unless defined(my $data = data_section(@args))
184 8 10 file_is_binary(@args) ? :
190 60 813 -f $path && -r _ ? :