Skip to content

Commit

Permalink
Merge branch 'gh/683' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
xsawyerx committed Aug 9, 2012
2 parents d3614ff + 4d85e4d commit d27c2b1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Dancer/Renderer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,15 @@ sub get_file_response {

my $app = Dancer::App->current;
# TODO: this should be later removed with a check whether the file exists
# and then returning a 404, path_or_empty should be removed
my $static_file = path_or_empty( $app->setting('public'), $path_info );
# and then returning a 404
my $public = defined $app->setting('public') ?
$app->setting('public') :
'';

my $static_file = path( $public, $path_info );

return if ( !$static_file
|| index( $static_file, path( $app->setting('public') ) ) != 0 );
|| index( $static_file, ( path($public) || '' ) ) != 0 );

return Dancer::Renderer->get_file_response_for_path( $static_file, undef,
$request->content_type );
Expand Down

0 comments on commit d27c2b1

Please sign in to comment.