use grit to get the file's mime type, as suggested.

http://github.com/github/gollum/commit/6de9ddfd3f79a9cb320aab3c43b8e0a912107b2e#commitcomment-137656
This commit is contained in:
rick
2010-08-30 18:25:48 -07:00
parent bf37f44970
commit e0d234c255
3 changed files with 7 additions and 1 deletions
+1
View File
@@ -8,6 +8,7 @@
* Minor Enhancements * Minor Enhancements
* Support a `:gollum_path` Sinatra setting for `Precious::App` * Support a `:gollum_path` Sinatra setting for `Precious::App`
* Add Wiki#size to efficiently count pages without loading them. * Add Wiki#size to efficiently count pages without loading them.
* Add the correct content type when serving files from the frontend.
* Bug Fixes * Bug Fixes
* Increase minimum Sanitize version requirement to 1.1.0. * Increase minimum Sanitize version requirement to 1.1.0.
1.0.x versions of Sanitize require Hpricot instead of Nokogiri 1.0.x versions of Sanitize require Hpricot instead of Nokogiri
+5
View File
@@ -33,6 +33,11 @@ module Gollum
# Public: The String path of the file. # Public: The String path of the file.
attr_reader :path attr_reader :path
# Public: The String mime type of the file.
def mime_type
@blob.mime_type
end
######################################################################### #########################################################################
# #
# Internal Methods # Internal Methods
+1 -1
View File
@@ -141,7 +141,7 @@ module Precious
@content = page.formatted_data @content = page.formatted_data
mustache :page mustache :page
elsif file = wiki.file(name) elsif file = wiki.file(name)
content_type MIME::Types.type_for(name).to_s content_type file.mime_type
file.raw_data file.raw_data
else else
@name = name @name = name