use Tree::Simple;
use Tree::Simple::Visitor::FindByPath;
use Catalyst::Request;
+use Catalyst::Request::Upload;
use Catalyst::Response;
require Module::Pluggable::Fast;
if ( my $location = $c->response->redirect ) {
$c->log->debug(qq/Redirecting to "$location"/) if $c->debug;
$c->response->header( Location => $location );
- $c->response->status(302) if $c->response->status !~ /3\d\d$/;
+ $c->response->status(302) if $c->response->status !~ /^3\d\d$/;
}
if ( $#{ $c->error } >= 0 ) {
$namespace = '' if $namespace eq '/';
my $parent = $c->tree;
my @results;
- my $result = $c->actions->{private}->{ $parent->getUID }->{$action};
- push @results, [$result] if $result;
- my $visitor = Tree::Simple::Visitor::FindByPath->new;
- for my $part ( split '/', $namespace ) {
- $visitor->setSearchPath($part);
- $parent->accept($visitor);
- my $child = $visitor->getResult;
- my $uid = $child->getUID if $child;
- my $match = $c->actions->{private}->{$uid}->{$action} if $uid;
- push @results, [$match] if $match;
- $parent = $child if $child;
+ my %allowed = ( begin => 1, auto => 1, default => 1, end => 1 );
+ if ( $allowed{$action} ) {
+ my $result = $c->actions->{private}->{ $parent->getUID }->{$action};
+ push @results, [$result] if $result;
+ my $visitor = Tree::Simple::Visitor::FindByPath->new;
+ for my $part ( split '/', $namespace ) {
+ $visitor->setSearchPath($part);
+ $parent->accept($visitor);
+ my $child = $visitor->getResult;
+ my $uid = $child->getUID if $child;
+ my $match = $c->actions->{private}->{$uid}->{$action} if $uid;
+ push @results, [$match] if $match;
+ $parent = $child if $child;
+ }
+ }
+ else {
+ if ($namespace) {
+ my $visitor = Tree::Simple::Visitor::FindByPath->new;
+ $visitor->setSearchPath( split '/', $namespace );
+ $parent->accept($visitor);
+ my $child = $visitor->getResult;
+ my $uid = $child->getUID if $child;
+ my $match = $c->actions->{private}->{$uid}->{$action}
+ if $uid;
+ push @results, [$match] if $match;
+ }
+ else {
+ my $result =
+ $c->actions->{private}->{ $parent->getUID }->{$action};
+ push @results, [$result] if $result;
+ }
}
return \@results;
}