Replace :nothing => true
with :text => ""
Using `:nothing => true` confusingly actually causes a single space to be sent as the content by rails.
This commit is contained in:
parent
d492628f3e
commit
3880ac5de8
11 changed files with 49 additions and 49 deletions
|
@ -45,7 +45,7 @@ class ApplicationController < ActionController::Base
|
|||
if request.get?
|
||||
redirect_to :controller => 'user', :action => 'login', :referer => request.fullpath
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -124,7 +124,7 @@ class ApplicationController < ActionController::Base
|
|||
flash[:error] = t('application.require_moderator.not_a_moderator')
|
||||
redirect_to :action => 'index'
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -325,7 +325,7 @@ class ApplicationController < ActionController::Base
|
|||
begin
|
||||
yield
|
||||
rescue ActiveRecord::RecordNotFound => ex
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
rescue LibXML::XML::Error, ArgumentError => ex
|
||||
report_error ex.message, :bad_request
|
||||
rescue ActiveRecord::RecordInvalid => ex
|
||||
|
@ -405,7 +405,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
respond_to do |format|
|
||||
format.html { render :template => "user/no_such_user", :status => :not_found }
|
||||
format.all { render :nothing => true, :status => :not_found }
|
||||
format.all { render :text => "", :status => :not_found }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class ChangesetController < ApplicationController
|
|||
changeset.set_closed_time_now
|
||||
|
||||
changeset.save!
|
||||
render :nothing => true
|
||||
render :text => ""
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -243,7 +243,7 @@ class ChangesetController < ApplicationController
|
|||
render :text => changeset.to_xml, :mime_type => "text/xml"
|
||||
else
|
||||
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class DiaryEntryController < ApplicationController
|
|||
@description = I18n.t('diary_entry.feed.user.description', :user => user.display_name)
|
||||
@link = "http://#{SERVER_URL}/user/#{user.display_name}/diary"
|
||||
else
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
return
|
||||
end
|
||||
else
|
||||
|
|
|
@ -39,7 +39,7 @@ class OldController < ApplicationController
|
|||
|
||||
def version
|
||||
if @old_element.redacted? and not show_redactions?
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
|
||||
else
|
||||
response.last_modified = @old_element.timestamp
|
||||
|
@ -66,7 +66,7 @@ class OldController < ApplicationController
|
|||
end
|
||||
|
||||
# just return an empty 200 OK for success
|
||||
render :nothing => true
|
||||
render :text => ""
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -45,7 +45,7 @@ class RelationController < ApplicationController
|
|||
relation.update_from new_relation, @user
|
||||
render :text => relation.version.to_s, :content_type => "text/plain"
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -56,7 +56,7 @@ class RelationController < ApplicationController
|
|||
relation.delete_with_history!(new_relation, @user)
|
||||
render :text => relation.version.to_s, :content_type => "text/plain"
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -125,7 +125,7 @@ class RelationController < ApplicationController
|
|||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
|
||||
else
|
||||
render :nothing => true, :status => :gone
|
||||
render :text => "", :status => :gone
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@ class SearchController < ApplicationController
|
|||
|
||||
if do_nodes
|
||||
response.headers['Error'] = "Searching of nodes is currently unavailable"
|
||||
render :nothing => true, :status => :service_unavailable
|
||||
render :text => "", :status => :service_unavailable
|
||||
return false
|
||||
end
|
||||
|
||||
unless value
|
||||
response.headers['Error'] = "Searching for a key without value is currently unavailable"
|
||||
render :nothing => true, :status => :service_unavailable
|
||||
render :text => "", :status => :service_unavailable
|
||||
return false
|
||||
end
|
||||
|
||||
|
|
|
@ -150,17 +150,17 @@ class TraceController < ApplicationController
|
|||
|
||||
if trace.visible? and (trace.public? or (@user and @user == trace.user))
|
||||
if Acl.no_trace_download(request.remote_ip)
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
elsif request.format == Mime::XML
|
||||
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment')
|
||||
else
|
||||
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -177,10 +177,10 @@ class TraceController < ApplicationController
|
|||
end
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
|
||||
def delete
|
||||
|
@ -193,13 +193,13 @@ class TraceController < ApplicationController
|
|||
flash[:notice] = t 'trace.delete.scheduled_for_deletion'
|
||||
redirect_to :action => :list, :display_name => @user.display_name
|
||||
else
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
|
||||
def georss
|
||||
|
@ -234,13 +234,13 @@ class TraceController < ApplicationController
|
|||
expires_in 7.days, :private => !trace.public?, :public => trace.public?
|
||||
send_file(trace.large_picture_name, :filename => "#{trace.id}.gif", :type => 'image/gif', :disposition => 'inline')
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
|
||||
def icon
|
||||
|
@ -251,13 +251,13 @@ class TraceController < ApplicationController
|
|||
expires_in 7.days, :private => !trace.public?, :public => trace.public?
|
||||
send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => 'image/gif', :disposition => 'inline')
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :nothing => true, :status => :not_found
|
||||
render :text => "", :status => :not_found
|
||||
end
|
||||
|
||||
def api_read
|
||||
|
@ -266,7 +266,7 @@ class TraceController < ApplicationController
|
|||
if trace.public? or trace.user == @user
|
||||
render :text => trace.to_xml.to_s, :content_type => "text/xml"
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -285,9 +285,9 @@ class TraceController < ApplicationController
|
|||
trace.visibility = new_trace.visibility
|
||||
trace.save!
|
||||
|
||||
render :nothing => true, :status => :ok
|
||||
render :text => "", :status => :ok
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -298,9 +298,9 @@ class TraceController < ApplicationController
|
|||
trace.visible = false
|
||||
trace.save!
|
||||
|
||||
render :nothing => true, :status => :ok
|
||||
render :text => "", :status => :ok
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -314,7 +314,7 @@ class TraceController < ApplicationController
|
|||
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => :forbidden
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -337,12 +337,12 @@ class TraceController < ApplicationController
|
|||
if @trace.id
|
||||
render :text => @trace.id.to_s, :content_type => "text/plain"
|
||||
elsif @trace.valid?
|
||||
render :nothing => true, :status => :internal_server_error
|
||||
render :text => "", :status => :internal_server_error
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def api_read
|
||||
render :nothing => true, :status => :gone unless @this_user.visible?
|
||||
render :text => "", :status => :gone unless @this_user.visible?
|
||||
end
|
||||
|
||||
def api_details
|
||||
|
|
|
@ -62,7 +62,7 @@ class UserPreferenceController < ApplicationController
|
|||
preference.save!
|
||||
end
|
||||
|
||||
render :nothing => true, :content_type => "text/plain"
|
||||
render :text => "", :content_type => "text/plain"
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -79,7 +79,7 @@ class UserPreferenceController < ApplicationController
|
|||
pref.v = request.raw_post.chomp
|
||||
pref.save!
|
||||
|
||||
render :nothing => true, :content_type => "text/plain"
|
||||
render :text => "", :content_type => "text/plain"
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -87,6 +87,6 @@ class UserPreferenceController < ApplicationController
|
|||
def delete_one
|
||||
UserPreference.find(@user.id, params[:preference_key]).delete
|
||||
|
||||
render :nothing => true, :content_type => "text/plain"
|
||||
render :text => "", :content_type => "text/plain"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class WayController < ApplicationController
|
|||
way.create_with_history @user
|
||||
render :text => way.id.to_s, :content_type => "text/plain"
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ class WayController < ApplicationController
|
|||
way.update_from(new_way, @user)
|
||||
render :text => way.version.to_s, :content_type => "text/plain"
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -56,7 +56,7 @@ class WayController < ApplicationController
|
|||
way.delete_with_history!(new_way, @user)
|
||||
render :text => way.version.to_s, :content_type => "text/plain"
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -99,7 +99,7 @@ class WayController < ApplicationController
|
|||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
render :text => "", :status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
end
|
||||
assert_response :success
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal " ", @response.body
|
||||
assert_equal "", @response.body
|
||||
assert_equal "new_value", UserPreference.find(1, "key").v
|
||||
assert_equal "value", UserPreference.find(1, "new_key").v
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
|
@ -156,7 +156,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
end
|
||||
assert_response :success
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal " ", @response.body
|
||||
assert_equal "", @response.body
|
||||
assert_equal "new_value", UserPreference.find(1, "new_key").v
|
||||
|
||||
# try changing the value of a preference
|
||||
|
@ -166,7 +166,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
end
|
||||
assert_response :success
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal " ", @response.body
|
||||
assert_equal "", @response.body
|
||||
assert_equal "newer_value", UserPreference.find(1, "new_key").v
|
||||
end
|
||||
|
||||
|
@ -189,7 +189,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
end
|
||||
assert_response :success
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal " ", @response.body
|
||||
assert_equal "", @response.body
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
UserPreference.find(1, "key")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue