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