Skip to content

Commit

Permalink
Should be a fix for MIME::Types 1.1.1 with 1.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Ziegler committed Oct 25, 2011
1 parent fdffe34 commit 7e22863
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 4 additions & 0 deletions 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.
Expand Down
2 changes: 1 addition & 1 deletion README.rdoc
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions 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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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, '')
Expand Down
6 changes: 3 additions & 3 deletions mime-types.gemspec
Expand Up @@ -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"]
Expand Down

0 comments on commit 7e22863

Please sign in to comment.