[ARVADOS] updated: f75e2ecbcb1e511e26ae34fb4ebb9bf81e1cbe8f

git at public.curoverse.com git at public.curoverse.com
Wed Mar 18 11:08:20 EDT 2015


Summary of changes:
 apps/workbench/config/initializers/mime_types.rb | 37 +++++++++++++++++-------
 1 file changed, 26 insertions(+), 11 deletions(-)

       via  f75e2ecbcb1e511e26ae34fb4ebb9bf81e1cbe8f (commit)
      from  c3604c1cc57556520634f9af57213abc80c86da9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f75e2ecbcb1e511e26ae34fb4ebb9bf81e1cbe8f
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Wed Mar 18 11:04:48 2015 -0400

    5375: enhance the mime_types initializer to add a new type only when that type is not yet supported by the MIME types gem.

diff --git a/apps/workbench/config/initializers/mime_types.rb b/apps/workbench/config/initializers/mime_types.rb
index f28391d..2cbdbd8 100644
--- a/apps/workbench/config/initializers/mime_types.rb
+++ b/apps/workbench/config/initializers/mime_types.rb
@@ -5,17 +5,32 @@
 # Mime::Type.register_alias "text/html", :iphone
 
 # add new mime types to register
-Mime::Type.register "application/fa", :fa
-Mime::Type.register "application/fasta", :fasta
-Mime::Type.register "application/go", :go
-Mime::Type.register "application/r", :r
-Mime::Type.register "application/sam", :sam
 
-# register MIME type with MIME::Type gem 
 require 'mime/types'
 include MIME
-MIME::Types.add(MIME::Type.new(["application/fa", %(fa)]))
-MIME::Types.add(MIME::Type.new(["application/fasta", %(fasta)]))
-MIME::Types.add(MIME::Type.new(["application/go", %(go)]))
-MIME::Types.add(MIME::Type.new(["application/r", %(r)]))
-MIME::Types.add(MIME::Type.new(["application/sam", %(sam)]))
+
+# register new MIME types with MIME::Types gem
+if (MIME::Types.type_for('file.fa').first.nil?)
+  Mime::Type.register "application/fa", :fa
+  MIME::Types.add(MIME::Type.new(["application/fa", %(fa)]))
+end
+
+if (MIME::Types.type_for('file.fasta').first.nil?)
+  Mime::Type.register "application/fasta", :fasta
+  MIME::Types.add(MIME::Type.new(["application/fasta", %(fasta)]))
+end
+
+if (MIME::Types.type_for('file.go').first.nil?)
+  Mime::Type.register "application/go", :go
+  MIME::Types.add(MIME::Type.new(["application/go", %(go)]))
+end
+
+if (MIME::Types.type_for('file.r').first.nil?)
+  Mime::Type.register "application/r", :r
+  MIME::Types.add(MIME::Type.new(["application/r", %(r)]))
+end
+
+if (MIME::Types.type_for('file.sam').first.nil?)
+  Mime::Type.register "application/sam", :sam
+  MIME::Types.add(MIME::Type.new(["application/sam", %(sam)]))
+end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list