updated to 0.10
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Plugin / Static / Simple.pm
index 708b265..ea5c86e 100644 (file)
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
 use File::stat;
+use File::Spec::Functions qw/catdir no_upwards splitdir/;
 use IO::File;
 use MIME::Types;
 use NEXT;
@@ -111,7 +112,7 @@ sub setup {
 sub _locate_static_file {
     my $c = shift;
     
-    my $path = $c->req->path;
+    my $path = catdir(no_upwards(splitdir( $c->req->path )));
     
     my @ipaths = @{ $c->config->{static}->{include_path} };
     my $dpaths;
@@ -172,15 +173,6 @@ sub _serve_static {
     my $full_path = $c->_static_file;
     my $stat = stat $full_path;
 
-    # the below code all from C::P::Static
-    if ( $c->req->headers->if_modified_since ) {
-        if ( $c->req->headers->if_modified_since == $stat->mtime ) {
-            $c->res->status( 304 ); # Not Modified
-            $c->res->headers->remove_content_headers;
-            return 1;
-        }
-    }
-    
     $c->res->headers->content_type( $type );
     $c->res->headers->content_length( $stat->size );
     $c->res->headers->last_modified( $stat->mtime );