Branch Coverage

blib/lib/Mojolicious/Plugin/StaticShare/Controller.pm
Criterion Covered Total %
branch 25 142 17.6


line true false branch
23 0 1 if not $c->is_admin and grep {/^\./u;} @{$c->stash('url_path')->parts;}
25 0 1 if ($c->plugin->access)
26 0 0 ref $c->plugin->access eq 'CODE' ? :
28 0 0 unless $access
31 0 0 if ref $access eq 'HASH'
35 0 1 if ($c->is_admin and $c->param('admin'))
43 1 0 if -d $file_path
45 0 0 if -f $file_path
58 0 0 if $c->plugin->debug
61 0 0 if (my $dir = $c->param('dir')) { }
0 0 elsif (my $rename = $c->param('rename')) { }
0 0 elsif (my $delete = $c->param('delete[]') && $c->every_param('delete[]')) { }
0 0 elsif (defined(my $edit = $c->param('edit'))) { }
62 0 0 if $c->is_admin
66 0 0 if $c->is_admin
70 0 0 if $c->is_admin
74 0 0 if $c->is_admin
80 0 0 if not $c->is_admin and grep {/^\./u;} @{$c->stash('url_path')->parts;}
82 0 0 unless $c->is_admin or $c->public_uploads
90 0 0 unless not $name or -w $file_path
94 0 0 if $c->req->is_limit_exceeded
97 0 0 unless my $file = $c->req->upload('file')
100 0 0 $name ? :
102 0 0 unless not $name or -d $file_path
104 0 0 if not $name and -d $to
107 0 0 if not $c->param('replace') and -e $to
110 0 0 unless eval { do { $file->asset->move_to($to) } }
114 0 0 if $name
140 0 1 if $c->stash('format')
154 0 1 if ($c->plugin->render_dir // '') eq 0
158 0 1 unless opendir my $dir, $path
167 2 15 if $_ eq '.' or $_ eq '..'
169 0 15 if not $c->is_admin and /^\./u
173 4 11 if -d $child and -r _
178 0 11 unless -f _
192 1 0 $c->plugin->dir_index ? :
195 2 1 unless -f $file
197 0 1 if $index =~ $c->plugin->re_markdown
202 1 0 if $index =~ $c->plugin->re_pod
209 0 0 ref $c->plugin->render_dir ? :
0 1 if $c->plugin->render_dir
229 0 0 unless $edir =~ /\S/u
234 0 0 if -e $to
249 0 0 unless $ename =~ /\S/u
254 0 0 if -e $to
257 0 0 unless my $move = eval { do { $path->move_to($to) } }
270 0 0 unless $del =~ /\S/u
274 0 0 unless -e $d
277 0 0 eval { do { $d->remove_tree } } ? :
287 0 0 unless -r $path
291 0 0 if $c->is_admin and $c->param('edit')
296 0 0 unless ($c->plugin->render_markdown || '') eq 0 or $c->param('attachment') or not $filename =~ $c->plugin->re_markdown
299 0 0 unless ($c->plugin->render_pod || '') eq 0 or $c->param('attachment') or not $filename =~ $c->plugin->re_pod
302 0 0 unless $c->param('attachment') or not $filename =~ $c->plugin->re_html
305 0 0 $c->param('attachment') ? :
316 0 0 unless $dom->find('script')->each(\&Mojolicious::Plugin::StaticShare::Controller::_sanitize_script)->size
329 0 0 unless $c->_stash_markdown($path)
334 0 0 ref $c->plugin->render_markdown ? :
0 0 $c->plugin->render_markdown ? :
342 0 0 unless my $md = $c->plugin->markdown
360 0 0 if $match[0] =~ s/$layout_ext_re//u
367 0 0 if $found
385 18 144 unless my $text = $el->text
390 3 141 unless $parent and $parent->type eq 'tag' and $child1->type eq 'text'
392 0 141 if ($content =~ s/^(?:\s*\{([^\}]+)\}\s*)//u)
411 0 0 unless $c->_stash_pod($path)
416 0 0 ref $c->plugin->render_pod ? :
0 0 $c->plugin->render_pod ? :
424 0 1 unless $c->app->renderer->helpers->{'pod_to_html'}
438 0 0 unless $c->render_maybe('Mojolicious-Plugin-StaticShare/not_found', 'format', 'html', 'handler', 'ep', 'status', 404)
445 0 0 unless (defined $edit)