Fixed bug where C<-T>/C<-B> were being called on strings.
[catagits/Gitalist.git] / lib / Gitalist / Controller / Ref.pm
index c0e4ce3..207d4ca 100644 (file)
@@ -23,14 +23,14 @@ sub raw : Chained('find') Does('FilenameArgs') Args() {
     my ($self, $c) = @_;
     $c->forward('find_blob');
 
-    if(-T $c->stash->{blob}) {
-       $c->response->content_type('text/plain; charset=utf-8');
+    if(!Gitalist::Utils::is_binary($c->stash->{blob})) {
+        $c->response->content_type('text/plain; charset=utf-8');
     } else {
-       my $ft = File::Type->new();
-       $c->response->content_type(
-           File::Type::WebImages::mime_type($c->stash->{blob})
-        || File::Type->new->mime_type($c->stash->{blob})
-       );
+        my $ft = File::Type->new();
+        $c->response->content_type(
+            File::Type::WebImages::mime_type($c->stash->{blob})
+         || File::Type->new->mime_type($c->stash->{blob})
+        );
     }
 
     $c->response->body(delete $c->stash->{blob});