Merge pull request #735 from ngyuki/fix-edit-for-multibyte
Fix `Encoding::CompatibilityError` of edit view.
This commit is contained in:
+1
-2
@@ -141,8 +141,7 @@ module Precious
|
||||
else
|
||||
@page = page
|
||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||
raw_data = page.raw_data
|
||||
@content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
|
||||
@content = page.text_data
|
||||
mustache :edit
|
||||
end
|
||||
else
|
||||
|
||||
@@ -22,7 +22,7 @@ module Precious
|
||||
def header
|
||||
if @header.nil?
|
||||
if page = @page.header
|
||||
@header = page.raw_data
|
||||
@header = page.text_data
|
||||
else
|
||||
@header = false
|
||||
end
|
||||
@@ -33,7 +33,7 @@ module Precious
|
||||
def footer
|
||||
if @footer.nil?
|
||||
if page = @page.footer
|
||||
@footer = page.raw_data
|
||||
@footer = page.text_data
|
||||
else
|
||||
@footer = false
|
||||
end
|
||||
@@ -44,7 +44,7 @@ module Precious
|
||||
def sidebar
|
||||
if @sidebar.nil?
|
||||
if page = @page.sidebar
|
||||
@sidebar = page.raw_data
|
||||
@sidebar = page.text_data
|
||||
else
|
||||
@sidebar = false
|
||||
end
|
||||
|
||||
@@ -504,6 +504,24 @@ context "Frontend" do
|
||||
Precious::App.set(:wiki_options, { :js => nil })
|
||||
end
|
||||
|
||||
test "show edit page with header and footer and sidebar of multibyte" do
|
||||
post "/create",
|
||||
:content => 'りんご',
|
||||
:page => 'Multibyte', :format => :markdown, :message => 'mesg'
|
||||
|
||||
post "/edit/Multibyte",
|
||||
:content => 'りんご', :header => 'みかん', :footer => 'バナナ', :sidebar => 'スイカ',
|
||||
:page => 'Multibyte', :format => :markdown, :message => 'mesg'
|
||||
|
||||
get "edit/Multibyte"
|
||||
|
||||
assert last_response.ok?
|
||||
assert_match /りんご/, last_response.body
|
||||
assert_match /みかん/, last_response.body
|
||||
assert_match /バナナ/, last_response.body
|
||||
assert_match /スイカ/, last_response.body
|
||||
end
|
||||
|
||||
def app
|
||||
Precious::App
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user