diff options
author | Austin Ziegler <austin@zieglers.ca> | 2014-05-22 23:17:29 -0400 |
---|---|---|
committer | Austin Ziegler <austin@zieglers.ca> | 2014-05-22 23:17:29 -0400 |
commit | fdf8bd7fecf297a55f625dbea065495fa12efb24 (patch) | |
tree | 955a9dd3941896ab8b16b41917cf7db5b2236852 | |
parent | 928e5092d693e8e9e8bfa5298665962b58978026 (diff) | |
download | mime-types-fdf8bd7fecf297a55f625dbea065495fa12efb24.tar.gz |
Fixing two tooling problems.
- The `template` for `audio/amr-wb+` was showing up as just `amr-wb+`,
which will not produce a usable URL to the template. In cases where a
file reference is the same as the subtype, change the file reference
to be the same as `type/subtype`.
- Make update matching case-insensitive.
-rw-r--r-- | History.rdoc | 13 | ||||
-rw-r--r-- | support/apache_mime_types.rb | 2 | ||||
-rw-r--r-- | support/iana_registry.rb | 12 |
3 files changed, 21 insertions, 6 deletions
diff --git a/History.rdoc b/History.rdoc index 1874f60..c6e0f2e 100644 --- a/History.rdoc +++ b/History.rdoc @@ -5,6 +5,15 @@ did not match a MIME::Type would be returned as +nil+ inside the returned array. This was incorrect behaviour as those values should not have been returned, resulting in an empty array. +* MIME Type Development Tools: + * As always, there are bugs in the IANA registry because it's manually + maintained. Some robustness has been added to properly writing file + template references where the file template reference is not a full media + type specification (e.g., 'amr-wb\+' instead of 'audio/amr-wb\+'). + * Both the IANA and Apache import tools were unnecessarily case-sensitive in + matching against already-existing MIME types, resulting in extra work to + weed out duplicates that differed only in the case of the canonical content + type. This has been fixed. == 2.2 / 2014-03-14 @@ -27,7 +36,7 @@ alias for MIME::Type#xref_urls, and MIME::Type#references= will be removed. * New or Updated MIME Types: * This information is now tracked in History-Types.rdoc. -* MIME Type Development Tools +* MIME Type Development Tools: * The IANA registry format changed, breaking the IANA registry tool previously used. Rewrote IANADownloader and IANADownloader::Parser as IANARegistryParser using the XML form. @@ -122,7 +131,7 @@ * text/plain (VMS .doc files) marked as non-standard. This type will be merged with the standard text/plain type in a future release. * Added md, markdown, rst, and textile extensions to text/plain. -* MIME Type Development Tools +* MIME Type Development Tools: * The benchmarking task has been moved mostly to support/benchmarker.rb. * A task for SimpleCov coverage has been added (<tt>rake test:coverage</tt>). * IANA type registry downloading has been substantially improved and the diff --git a/support/apache_mime_types.rb b/support/apache_mime_types.rb index 440b2b5..a5d1ba4 100644 --- a/support/apache_mime_types.rb +++ b/support/apache_mime_types.rb @@ -64,7 +64,7 @@ class ApacheMIMETypes extensions = record.last.split(/\s+/) types = @types.select { |t| - (t.content_type == content_type) + (t.content_type.downcase == content_type.downcase) } if types.empty? diff --git a/support/iana_registry.rb b/support/iana_registry.rb index ac22299..12b918a 100644 --- a/support/iana_registry.rb +++ b/support/iana_registry.rb @@ -96,11 +96,17 @@ class IANARegistry end record.css('file').each do |file| + file_name = if file.text == subtype + [ @type, subtype ].join('/') + else + file.text + end + if file["type"] == "template" - refs << (ASSIGNMENT_FILE_REF % [ file.text, file.text ]) + refs << (ASSIGNMENT_FILE_REF % [ file_name, file_name ]) end - xrefs[file["type"]] << file.text + xrefs[file["type"]] << file_name end content_type = [ @type, subtype ].join('/') @@ -108,7 +114,7 @@ class IANARegistry use_instead = record.at_css('deprecated').text rescue nil types = @types.select { |t| - (t.content_type == content_type) + (t.content_type.downcase == content_type.downcase) } if types.empty? |