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