Created
June 10, 2009 02:11
-
-
Save stephancom/126968 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I realize this declaration looks kind of crazy, but I find it | |
# way more readable and DRY than a straight list would be | |
# optionally add octet-stream to this list - evaluate security risk of any before doing so | |
CONTENT_TYPES = %w(gif jpg jpe jpeg pjpeg bmp png pdf x-png tiff).map { |st| "image/#{st}"} + | |
%w(vnd.ms-excel vnd.ms-powerpoint msword pdf).map { |st| "application/#{st}"} + | |
[ "text/plain" ] + | |
# Don't blame me, blame Microsoft - this is for Office 2007. | |
# It makes a lot of MIME types that we shouldn't actually make, | |
# but that seems pretty harmless. | |
# original list from http://www.bram.us/2007/05/25/office-2007-mime-types-for-iis/ | |
%w(ms-word ms-powerpoint ms-excel).map { |t| | |
%w(document template addin sheet sheet.binary slideshow presentation).map{ |s| | |
"application/vnd.#{t}.#{s}.macroEnabled.12"}} + | |
%w(wordprocessing presentation sheet).map { |t| | |
%w(document template sheet slideshow presentation).map{ |s| | |
"application/vnd.openxmlformats-officedocument.#{t}ml.#{s}"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment