Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regexp to use case-insensitivity correctly #889

Merged
merged 1 commit into from
May 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix regexp to use case-insensitivity correctly
The regexp /[A-z]/ matches all alphabets, but also six non-alphabetic
characters, as demonstrated by ("A".."z").to_a.join
=> "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz"
  • Loading branch information
rennex committed Jun 19, 2014
commit c57cad9848bad3b007fcfba033644492e611deb7
2 changes: 1 addition & 1 deletion lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def redirect(uri, *args)
# Generates the absolute URI for a given path in the app.
# Takes Rack routers and reverse proxies into account.
def uri(addr = nil, absolute = true, add_script_name = true)
return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/
return addr if addr =~ /\A[a-z][a-z0-9\+\.\-]*:/i
uri = [host = ""]
if absolute
host << "http#{'s' if request.secure?}://"
Expand Down