Branch Coverage

blib/lib/Mojolicious/Static.pm
Criterion Covered Total %
branch 64 66 96.9


line true false branch
22 1 13 unless $asset =~ m[^/]u
33 153 862 unless $method eq "GET" or $method eq "HEAD"
38 62 800 $stash->{'path'} ? :
39 82 780 unless my(@parts) = @{$path->canonicalize->parts;}
43 713 67 if $canon_path =~ m[^\.\./|\\]u or not $self->serve($c, $canon_path)
47 7 60 if $c->app->mode eq "development" and index($canon_path, $self->asset_dir) == 0
56 38 745 unless $self->{'index'}
61 746 42 unless my $asset = _get_file(path($path, @parts)->to_string)
66 16 725 if (my $asset = $self->_get_data_file($rel))
70 17 708 exists $extra->{$rel} ? :
78 79 18 if $last
79 3 85 $etag =~ m[^W/"]u ? :
88 9 if $etag
84 76 21 unless my $since = $req_headers->if_modified_since or $match
88 14 9 unless $_ eq $etag
4 17 if $match and not grep({"W/$_" eq $etag unless $_ eq $etag;} map({trim($_);} split(/,/u, $match, 0)))
91 11 6 unless $last //= $res_headers->last_modified and $since
97 706 73 unless my $asset = $self->file($rel)
106 58 19 if $asset->is_file
113 3 74 if $self->is_fresh($c, $options)
116 58 16 unless my $range = $c->req->headers->range
119 1 15 unless my $size = $asset->size
120 0 15 unless $range =~ /^bytes=(\d+)?-(\d+)?/u
121 10 5 defined $2 && $2 < $size ? :
122 3 12 if $start > $end
141 37 41 unless -d $asset_path
148 41 246 unless $filename =~ /^([^.]+)\.([^.]+)\.(.+)$/u
150 82 164 $prefix eq '' ? :
153 246 0 if not exists $assets->{$short} or $checksum eq "development"
164 646 95 if not $rel =~ /\.\w+$/u or $rel =~ /\.\w+\.\w+$/u
168 79 16 unless defined(my $data = data_section(@args))
169 7 9 file_is_binary(@args) ? :
175 59 746 -f $path && -r _ ? :