Skip to content

Commit b34296d

Browse files
committed
For [GH #117] [GH #112] - avoid wrongly loading files other than *.ydo as actions.
1 parent c9507f9 commit b34296d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Lite/WebMVC0/DirApp.pm

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use YATT::Lite -as_base, qw/*SYS *CON
99
use YATT::Lite::MFields qw/cf_dir_config
1010
cf_use_subpath
1111
cf_overwrite_status_code_for_errors_as
12+
cf_ext_public_action
1213
1314
Action/;
1415

@@ -25,6 +26,12 @@ use YATT::Lite::Util qw/cached_in ckeval
2526

2627
use YATT::Lite::Error;
2728

29+
sub after_new {
30+
(my MY $self) = @_;
31+
$self->SUPER::after_new;
32+
$self->{cf_ext_public_action} //= $self->default_ext_public_action;
33+
}
34+
2835
# sub handle_ydo, _do, _psgi...
2936

3037
sub handle {
@@ -106,6 +113,8 @@ sub prepare_part_handler {
106113
# Action handling
107114
#========================================
108115

116+
sub default_ext_public_action {'ydo'}
117+
109118
sub find_handler {
110119
(my MY $self, my ($ext, $file, $con)) = @_;
111120
my PROP $prop = $con->prop;
@@ -144,6 +153,7 @@ sub get_action_handler {
144153
($self->{Action} //= {}, $path, $self, undef, sub {
145154
# first time.
146155
my ($self, $sys, $path) = @_;
156+
return undef unless $path =~ m{\.$self->{cf_ext_public_action}\z};
147157
my $age = -M $path;
148158
return undef if not defined $age and $can_be_missing;
149159
my $sub = compile_file_in(ref $self, $path);

0 commit comments

Comments
 (0)