FIX: Sanitize.clean raise Encoding::CompatibilityError if a page contains non ASCII-7 characters
This commit is contained in:
@@ -11,7 +11,7 @@ module Gollum
|
||||
def initialize(page)
|
||||
@wiki = page.wiki
|
||||
@name = page.filename
|
||||
@data = page.raw_data
|
||||
@data = page.text_data
|
||||
@version = page.version.id
|
||||
@dir = ::File.dirname(page.path)
|
||||
@tagmap = {}
|
||||
|
||||
+14
-1
@@ -116,6 +116,19 @@ module Gollum
|
||||
@blob && @blob.data
|
||||
end
|
||||
|
||||
# Public: A text data encoded in specified encoding.
|
||||
#
|
||||
# encoding - An Encoding or nil
|
||||
#
|
||||
# Returns a character encoding aware String.
|
||||
def text_data(encoding=nil)
|
||||
if raw_data.respond_to?(:encoding)
|
||||
raw_data.force_encoding(encoding || Encoding::UTF_8)
|
||||
else
|
||||
raw_data
|
||||
end
|
||||
end
|
||||
|
||||
# Public: The formatted contents of the page.
|
||||
#
|
||||
# Returns the String data.
|
||||
@@ -344,4 +357,4 @@ module Gollum
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user