]> source.dussan.org Git - redmine.git/commitdiff
Use Redmine::MimeType.of instead of regexp to check if the attachment is Textile...
authorGo MAEDA <maeda@farend.jp>
Thu, 3 Oct 2019 09:30:43 +0000 (09:30 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 3 Oct 2019 09:30:43 +0000 (09:30 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@18586 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/attachment.rb
lib/redmine/mime_type.rb

index 0cd6664992a9e62e3a73bfeac9a388b42d55f29d..0b151dabbeaf05c113f4d90282307f77283f2bb3 100644 (file)
@@ -245,7 +245,7 @@ class Attachment < ActiveRecord::Base
   end
 
   def is_textile?
-    self.filename =~ /\.textile$/i
+    Redmine::MimeType.of(filename) == 'text/x-textile'
   end
 
   def is_image?
index e4801da210750b6b5611d711f6c2c50587099ba0..23bd3df1d6674f62401202138745ae70b386386c 100644 (file)
@@ -35,6 +35,7 @@ module Redmine
       'text/x-ruby' => 'rb,rbw,ruby,rake,erb',
       'text/x-csh' => 'csh',
       'text/x-sh' => 'sh',
+      'text/x-textile' => 'textile',
       'text/xml' => 'xml,xsd,mxml',
       'text/yaml' => 'yml,yaml',
       'text/csv' => 'csv',