]> source.dussan.org Git - redmine.git/commitdiff
WikiContent::Version#text may return ascii-8bit encoded string (#10590).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 6 Apr 2012 07:21:51 +0000 (07:21 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 6 Apr 2012 07:21:51 +0000 (07:21 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9329 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/wiki_content.rb

index 1bbdf09cbc7cc540c2bf0e3d0d96b8460d2c8f2b..1787a7898bb4792d74cb162d5f4bfb271381b0e3 100644 (file)
@@ -91,14 +91,16 @@ class WikiContent < ActiveRecord::Base
     end
 
     def text
-      @text ||= case compression
-      when 'gzip'
-        str = Zlib::Inflate.inflate(data)
+      @text ||= begin
+        str = case compression
+              when 'gzip'
+                Zlib::Inflate.inflate(data)
+              else
+                # uncompressed data
+                data
+              end
         str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
         str
-      else
-        # uncompressed data
-        data
       end
     end