From 84df2aaa0a0c9a64dc355beede3768ce22155abf Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 27 Sep 2011 10:18:44 -0500 Subject: [PATCH] Encoding could still be nil --- lib/linguist/blob_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/linguist/blob_helper.rb b/lib/linguist/blob_helper.rb index ab48e918..22ce0cd0 100644 --- a/lib/linguist/blob_helper.rb +++ b/lib/linguist/blob_helper.rb @@ -53,7 +53,9 @@ module Linguist # # Returns a content type String. def content_type - @content_type ||= binary? ? mime_type : "text/plain; charset=#{encoding.downcase}" + @content_type ||= binary? ? + mime_type : + (encoding ? "text/plain; charset=#{encoding.downcase}" : "text/plain") end # Public: Get the Content-Disposition header value