Skip to content

Commit 754c0f8

Browse files
committed
[ci skip] Update documenation formatting to link to methods/constants and fix code fences
1 parent 1000465 commit 754c0f8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

actionpack/lib/action_controller/metal/redirecting.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ class UnsafeRedirectError < StandardError; end
6666
# === Open Redirect protection
6767
#
6868
# By default, Rails protects against redirecting to external hosts for your app's safety, so called open redirects.
69-
# Note: this was a new default in Rails 7.0, after upgrading opt-in by uncommenting the line with `raise_on_open_redirects` in `config/initializers/new_framework_defaults_7_0.rb`
69+
# Note: this was a new default in Rails 7.0, after upgrading opt-in by uncommenting the line with #raise_on_open_redirects in <tt>config/initializers/new_framework_defaults_7_0.rb</tt>
7070
#
71-
# Here redirect_to automatically validates the potentially-unsafe URL:
71+
# Here #redirect_to automatically validates the potentially-unsafe URL:
7272
#
7373
# redirect_to params[:redirect_url]
7474
#
75-
# Raises <tt>ActionController::Redirecting::UnsafeRedirectError</tt> in the case of an unsafe redirect.
75+
# Raises #UnsafeRedirectError in the case of an unsafe redirect.
7676
#
7777
# To allow any external redirects pass `allow_other_host: true`, though using a user-provided param in that case is unsafe.
7878
#
7979
# redirect_to "https://rubyonrails.org", allow_other_host: true
8080
#
81-
# See <tt>url_from</tt> for more information on what an internal and safe URL is, or how to fall back to an alternate redirect URL in the unsafe case.
81+
# See #url_from for more information on what an internal and safe URL is, or how to fall back to an alternate redirect URL in the unsafe case.
8282
def redirect_to(options = {}, response_options = {})
8383
raise ActionControllerError.new("Cannot redirect to nil!") unless options
8484
raise AbstractController::DoubleRenderError if response_body
@@ -152,7 +152,7 @@ def _compute_redirect_to_location(request, options) # :nodoc:
152152
#
153153
# redirect_to url_from(params[:redirect_url]) || root_url
154154
#
155-
# The +location+ is considered internal, and safe, if it's on the same host as the <tt>request.host</tt>:
155+
# The +location+ is considered internal, and safe, if it's on the same host as <tt>request.host</tt>:
156156
#
157157
# # If request.host is example.com:
158158
# url_from("https://example.com/profile") # => "https://example.com/profile"
@@ -164,8 +164,8 @@ def _compute_redirect_to_location(request, options) # :nodoc:
164164
# # If request.host is on https://example.com or https://app.example.com, you'd get:
165165
# url_from("https://dev.example.com/profile") # => nil
166166
#
167-
# NOTE: there's a similarity with <tt>url_for</tt>, which generates an internal URL from various options from within the app, e.g. `url_for(@post)`.
168-
# However, <tt>url_from</tt> is meant to take an external parameter to verify as in `url_from(params[:redirect_url])`.
167+
# NOTE: there's a similarity with #url_for, which generates an internal URL from various options from within the app, e.g. <tt>url_for(@post)</tt>.
168+
# However, #url_from is meant to take an external parameter to verify as in <tt>url_from(params[:redirect_url])</tt>.
169169
def url_from(location)
170170
location = location.presence
171171
location if location && _url_host_allowed?(location)

0 commit comments

Comments
 (0)