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 153 874 unless $method eq "GET" or $method eq "HEAD"
39 62 812 $stash->{'path'} ? :
40 82 792 unless my(@parts) = @{$path->canonicalize->parts;}
44 720 72 if $canon_path =~ m[^\.\./|\\]u or not $self->serve($c, $canon_path)
48 7 65 if $c->app->mode eq "development" and index($canon_path, $self->asset_dir) == 0
57 39 751 unless $self->{'index'}
62 751 44 unless my $asset = _get_file(path($path, @parts)->to_string)
67 18 728 if (my $asset = $self->_get_data_file($rel))
71 18 710 exists $extra->{$rel} ? :
76 44 350 unless $file =~ m[^/]u
77 340 54 unless my $prefix = $self->prefix
86 84 18 if $last
87 3 90 $etag =~ m[^W/"]u ? :
93 9 if $etag
92 81 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 780 if (my $prefix = $self->prefix)
109 5 6 unless $rel =~ s[^\Q$prefix\E/][]u
112 708 78 unless my $asset = $self->file($rel)
121 61 21 if $asset->is_file
128 3 79 if $self->is_fresh($c, $options)
131 62 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 37 42 unless -d $asset_path
163 42 252 unless $filename =~ /^([^.]+)\.([^.]+)\.(.+)$/u
165 84 168 $prefix eq '' ? :
168 252 0 if not exists $assets->{$short} or $checksum eq "development"
179 648 98 if not $rel =~ /\.\w+$/u or $rel =~ /\.\w+\.\w+$/u
183 80 18 unless defined(my $data = data_section(@args))
184 8 10 file_is_binary(@args) ? :
190 62 751 -f $path && -r _ ? :