Skip to content

Commit

Permalink
Use File::Spec for path operations
Browse files Browse the repository at this point in the history
Also make sure that the filename is relative before prepending a path.
  • Loading branch information
nwellnhof committed Aug 24, 2012
1 parent 4e5f14d commit 30fded2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Plack/Middleware/XSLT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use strict;

use parent 'Plack::Middleware';

use File::Spec;
use HTTP::Exception;
use Plack::Response;
use Plack::Util::Accessor qw(cache path parser_options);
Expand All @@ -23,7 +24,8 @@ sub call {
return $r if !defined($style) || $style eq '';

my $path = $self->path;
$style = "$path/$style" if defined($path);
$style = File::Spec->catfile($path, $style)
if defined($path) && !File::Spec->file_name_is_absolute($style);

my ($status, $headers, $body) = @$r;
my $doc = $self->_parse_body($body);
Expand Down

0 comments on commit 30fded2

Please sign in to comment.