Fixes
Fix Session CookieOverflow bug when rescuing an InstikiValidation error. Fix some random things which will cause problems with Ruby 1.9. (Plenty more where those came from.)
This commit is contained in:
parent
dfb0f5f347
commit
bceb1864df
|
@ -107,7 +107,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def remember_location
|
||||
if request.method == :get and
|
||||
response.headers['Status'] == '200 OK' and not
|
||||
response.headers['Status'] == '200 OK' and not \
|
||||
%w(locked save back file pic import).include?(action_name)
|
||||
session[:return_to] = request.request_uri
|
||||
logger.debug "Session ##{session.object_id}: remembered URL '#{session[:return_to]}'"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'fileutils'
|
||||
require 'maruku'
|
||||
require 'parsedate'
|
||||
require 'zip/zip'
|
||||
require 'stringsupport'
|
||||
require 'resolv'
|
||||
|
@ -241,30 +240,18 @@ class WikiController < ApplicationController
|
|||
begin
|
||||
the_content = params['content']
|
||||
filter_spam(the_content)
|
||||
raise Instiki::ValidationError.new('Your content was not valid utf-8.') unless the_content.is_utf8?
|
||||
if @page
|
||||
if the_content.is_utf8?
|
||||
wiki.revise_page(@web_name, @page_name, the_content, Time.now,
|
||||
Author.new(author_name, remote_ip), PageRenderer.new)
|
||||
@page.unlock
|
||||
else
|
||||
flash[:error] = 'Your content was not valid utf-8.'
|
||||
@page.unlock
|
||||
redirect_to :back
|
||||
return
|
||||
end
|
||||
wiki.revise_page(@web_name, @page_name, the_content, Time.now,
|
||||
Author.new(author_name, remote_ip), PageRenderer.new)
|
||||
@page.unlock
|
||||
else
|
||||
if the_content.is_utf8?
|
||||
wiki.write_page(@web_name, @page_name, the_content, Time.now,
|
||||
Author.new(author_name, remote_ip), PageRenderer.new)
|
||||
else
|
||||
flash[:error] = 'Your content was not valid utf-8.'
|
||||
redirect_to :back
|
||||
return
|
||||
end
|
||||
wiki.write_page(@web_name, @page_name, the_content, Time.now,
|
||||
Author.new(author_name, remote_ip), PageRenderer.new)
|
||||
end
|
||||
redirect_to_page @page_name
|
||||
rescue => e
|
||||
flash[:error] = e
|
||||
rescue Instiki::ValidationError => e
|
||||
flash[:error] = e.to_s
|
||||
logger.error e
|
||||
if @page
|
||||
@page.unlock
|
||||
|
@ -285,7 +272,7 @@ class WikiController < ApplicationController
|
|||
# the application itself (for application errors, it's better not to rescue the error at all)
|
||||
rescue => e
|
||||
logger.error e
|
||||
flash[:error] = e
|
||||
flash[:error] = e.to_s
|
||||
if in_a_web?
|
||||
redirect_to :action => 'edit', :web => @web_name, :id => @page_name
|
||||
else
|
||||
|
|
|
@ -612,7 +612,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
|||
|
||||
assert_redirected_to :action => 'edit', :web => 'wiki1', :id => 'HomePage'
|
||||
# assert(@response.has_key(:error))
|
||||
assert r.flash[:error].kind_of?(Instiki::ValidationError)
|
||||
# assert r.flash[:error].kind_of?(Instiki::ValidationError)
|
||||
|
||||
revisions_after = @home.revisions.size
|
||||
assert_equal revisions_before, revisions_after
|
||||
|
|
2
vendor/plugins/rubyzip-0.9.1/lib/zip/zip.rb
vendored
2
vendor/plugins/rubyzip-0.9.1/lib/zip/zip.rb
vendored
|
@ -1,7 +1,7 @@
|
|||
require 'delegate'
|
||||
require 'singleton'
|
||||
require 'tempfile'
|
||||
require 'ftools'
|
||||
require 'fileutils'
|
||||
require 'stringio'
|
||||
require 'zlib'
|
||||
require 'zip/stdrubyext'
|
||||
|
|
|
@ -54,8 +54,8 @@ module SQLite3
|
|||
case mode
|
||||
when String
|
||||
case mode.downcase
|
||||
when "on", "yes", "true", "y", "t": mode = "'ON'"
|
||||
when "off", "no", "false", "n", "f": mode = "'OFF'"
|
||||
when "on", "yes", "true", "y", "t" then mode = "'ON'"
|
||||
when "off", "no", "false", "n", "f" then mode = "'OFF'"
|
||||
else
|
||||
raise Exception,
|
||||
"unrecognized pragma parameter #{mode.inspect}"
|
||||
|
|
Loading…
Reference in a new issue