Permalink
Browse files

Should be a fix for MIME::Types 1.1.1 with 1.9.

  • Loading branch information...
1 parent fdffe34 commit 7e2286375ef51be03732911000a2a682e6668334 Austin Ziegler committed Oct 25, 2011
Showing with 18 additions and 9 deletions.
  1. +4 −0 History.rdoc
  2. +1 −1 README.rdoc
  3. +10 −5 lib/mime/types.rb
  4. +3 −3 mime-types.gemspec
View
4 History.rdoc
@@ -1,3 +1,7 @@
+== MIME::Types 1.17.2 / 2011-10-25
+* Bug Fixes:
+ * Fixed an issue with Ruby 1.9 and file encoding.
+
== MIME::Types 1.17.1 / 2011-10-23
* Minor Enhancements:
* Implemented modern 'hoe' semantics.
View
2 README.rdoc
@@ -3,7 +3,7 @@
== Description
This library allows for the identification of a file's likely MIME content
-type. This is release 1.17.1. The identification of MIME content type is based
+type. This is release 1.17.2. The identification of MIME content type is based
on a file's filename extensions.
MIME::Types for Ruby originally based on and synchronized with MIME::Types for
View
15 lib/mime/types.rb
@@ -1,4 +1,4 @@
-# -*- ruby encoding: utf-8
+# -*- ruby encoding: utf-8 -*-
# The namespace for MIME applications, tools, and libraries.
module MIME
@@ -24,7 +24,7 @@ class InvalidContentType < RuntimeError; end
# puts MIME::Type.simplified('x-appl/x-zip') # => 'appl/zip'
#
class Type
- VERSION = '1.17.1'
+ VERSION = '1.17.2'
include Comparable
@@ -566,7 +566,7 @@ def to_hash
# = Author
# Copyright:: Copyright (c) 2002 - 2009 by Austin Ziegler
# <austin@rubyforge.org>
- # Version:: 1.17.1
+ # Version:: 1.17.2
# Based On:: Perl
# MIME::Types[http://search.cpan.org/author/MARKOV/MIME-Types-1.27/MIME/Types.pm],
# Copyright (c) 2001 - 2009 by Mark Overmeer
@@ -577,7 +577,7 @@ def to_hash
#
class Types
# The released version of Ruby MIME::Types
- VERSION = '1.17.1'
+ VERSION = '1.17.2'
# The data version.
attr_reader :data_version
@@ -752,7 +752,12 @@ def index_extensions(mime_type) #:nodoc:
# more information that's available, though, the richer the values that can
# be provided.
def load_from_file(filename) #:nodoc:
- data = File.open(filename) { |f| f.read }.split($/)
+ if defined? ::Encoding
+ data = File.open(filename, 'r:UTF-8') { |f| f.read }
+ else
+ data = File.open(filename) { |f| f.read }
+ end
+ data = data.split($/)
mime = MIME::Types.new
data.each_with_index { |line, index|
item = line.chomp.strip.gsub(%r{#.*}o, '')
View
6 mime-types.gemspec
@@ -2,12 +2,12 @@
Gem::Specification.new do |s|
s.name = "mime-types"
- s.version = "1.17.1"
+ s.version = "1.17.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Austin Ziegler"]
- s.date = "2011-10-24"
- s.description = "This library allows for the identification of a file's likely MIME content\ntype. This is release 1.17.1. The identification of MIME content type is based\non a file's filename extensions.\n\nMIME::Types for Ruby originally based on and synchronized with MIME::Types for\nPerl by Mark Overmeer, copyright 2001 - 2009. As of version 1.15, the data\nformat for the MIME::Type list has changed and the synchronization will no\nlonger happen.\n\nHomepage:: http://mime-types.rubyforge.org/\nGitHub:: http://github.com/halostatue/mime-types/\nCopyright:: 2002 - 2011, Austin Ziegler\n Based in part on prior work copyright Mark Overmeer\n\n:include: License.rdoc"
+ s.date = "2011-10-25"
+ s.description = "This library allows for the identification of a file's likely MIME content\ntype. This is release 1.17.2. The identification of MIME content type is based\non a file's filename extensions.\n\nMIME::Types for Ruby originally based on and synchronized with MIME::Types for\nPerl by Mark Overmeer, copyright 2001 - 2009. As of version 1.15, the data\nformat for the MIME::Type list has changed and the synchronization will no\nlonger happen.\n\nHomepage:: http://mime-types.rubyforge.org/\nGitHub:: http://github.com/halostatue/mime-types/\nCopyright:: 2002 - 2011, Austin Ziegler\n Based in part on prior work copyright Mark Overmeer\n\n:include: License.rdoc"
s.email = ["austin@rubyforge.org"]
s.extra_rdoc_files = ["Manifest.txt", "type-lists/application.txt", "type-lists/audio.txt", "type-lists/image.txt", "type-lists/message.txt", "type-lists/model.txt", "type-lists/multipart.txt", "type-lists/text.txt", "type-lists/video.txt", "History.rdoc", "License.rdoc", "README.rdoc"]
s.files = [".hoerc", "History.rdoc", "Licence.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "lib/mime/types.rb", "lib/mime/types/application", "lib/mime/types/application.mac", "lib/mime/types/application.nonstandard", "lib/mime/types/application.obsolete", "lib/mime/types/audio", "lib/mime/types/audio.nonstandard", "lib/mime/types/audio.obsolete", "lib/mime/types/image", "lib/mime/types/image.nonstandard", "lib/mime/types/image.obsolete", "lib/mime/types/message", "lib/mime/types/message.obsolete", "lib/mime/types/model", "lib/mime/types/multipart", "lib/mime/types/multipart.nonstandard", "lib/mime/types/multipart.obsolete", "lib/mime/types/other.nonstandard", "lib/mime/types/text", "lib/mime/types/text.nonstandard", "lib/mime/types/text.obsolete", "lib/mime/types/text.vms", "lib/mime/types/video", "lib/mime/types/video.nonstandard", "lib/mime/types/video.obsolete", "mime-types.gemspec", "test/test_mime_type.rb", "test/test_mime_types.rb", "type-lists/application.txt", "type-lists/audio.txt", "type-lists/image.txt", "type-lists/message.txt", "type-lists/model.txt", "type-lists/multipart.txt", "type-lists/text.txt", "type-lists/video.txt", "License.rdoc", ".gemtest"]

0 comments on commit 7e22863

Please sign in to comment.