George S. Baugh 5 anni fa
parent
commit
72e7afb3f2
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      lib/Trog/Data/DUMMY.pm

+ 5 - 0
lib/Trog/Data/DUMMY.pm

@@ -10,6 +10,7 @@ use Carp qw{confess};
 use JSON::MaybeXS;
 use File::Slurper;
 use File::Copy;
+use Mojo::File;
 
 =head1 WARNING
 
@@ -191,6 +192,10 @@ sub _process ($post) {
     delete $post->{file};
     delete $post->{preview_file};
 
+    my $mf = Mojo::File->new("www/$post->{href}");
+    my $ext = '.'.$mf->extname();
+    $post->{content_type} = Plack::MIME->mime_type($ext) if $ext;
+
     return $post;
 }