mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Remove binary override, set encoding instead
This commit is contained in:
@@ -1,21 +1,6 @@
|
||||
require 'mime/types'
|
||||
require 'yaml'
|
||||
|
||||
module MIME
|
||||
class Type
|
||||
attr_accessor :binary
|
||||
|
||||
undef_method :binary?
|
||||
def binary?
|
||||
if defined? @binary
|
||||
@binary
|
||||
else
|
||||
@encoding == 'base64'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Register additional mime type extensions
|
||||
mime_extensions = YAML.load_file(File.expand_path("../mimes.yml", __FILE__))
|
||||
mime_extensions.each do |mime_type, options|
|
||||
@@ -34,6 +19,7 @@ mime_extensions.each do |mime_type, options|
|
||||
end
|
||||
|
||||
mime.binary = options['binary'] if options.key?('binary')
|
||||
mime.encoding = options['encoding'] if options.key?('encoding')
|
||||
|
||||
MIME::Types.add_type_variant(mime)
|
||||
MIME::Types.index_extensions(mime)
|
||||
|
||||
@@ -1,44 +1,20 @@
|
||||
# Additional types to add to MIME::Types
|
||||
|
||||
application/atom+xml:
|
||||
binary: false
|
||||
|
||||
application/javascript:
|
||||
binary: false
|
||||
|
||||
application/json:
|
||||
binary: false
|
||||
|
||||
application/rdf+xml:
|
||||
binary: false
|
||||
|
||||
application/sh:
|
||||
binary: false
|
||||
|
||||
application/x-troff-ms:
|
||||
binary: false
|
||||
encoding: 8bit
|
||||
|
||||
application/netcdf:
|
||||
binary: false
|
||||
encoding: 8bit
|
||||
|
||||
application/x-pagemaker:
|
||||
exclude_extensions:
|
||||
- pm
|
||||
|
||||
application/x-perl:
|
||||
binary: false
|
||||
|
||||
application/x-python:
|
||||
binary: false
|
||||
|
||||
application/x-ruby:
|
||||
binary: false
|
||||
|
||||
application/x-wais-source:
|
||||
binary: false
|
||||
encoding: 8bit
|
||||
|
||||
application/vnd.mozilla.xul+xml:
|
||||
binary: false
|
||||
encoding: 8bit
|
||||
|
||||
application/vnd.adobe.air-application-installer-package+zip:
|
||||
extensions:
|
||||
@@ -74,7 +50,7 @@ application/octet-stream:
|
||||
- xpi
|
||||
|
||||
application/postscript:
|
||||
binary: true
|
||||
encoding: base64
|
||||
|
||||
application/java-archive:
|
||||
extensions:
|
||||
@@ -89,15 +65,6 @@ application/x-shockwave-flash:
|
||||
extensions:
|
||||
- swf
|
||||
|
||||
image/gif:
|
||||
attachment: false
|
||||
|
||||
image/jpeg:
|
||||
attachment: false
|
||||
|
||||
image/png:
|
||||
attachment: false
|
||||
|
||||
image/x-icns:
|
||||
extensions:
|
||||
- icns
|
||||
@@ -115,11 +82,11 @@ application/x-silverlight-app:
|
||||
- xap
|
||||
|
||||
application/xaml+xml:
|
||||
binary: false
|
||||
encoding: 8bit
|
||||
extensions:
|
||||
- xaml
|
||||
|
||||
application/x-ms-xbap:
|
||||
binary: false
|
||||
encoding: 8bit
|
||||
extensions:
|
||||
- xbap
|
||||
|
||||
Reference in New Issue
Block a user