Skip to content

Commit

Permalink
moving check fo scheme-relative URI into is_uri?
Browse files Browse the repository at this point in the history
  • Loading branch information
chadk committed Apr 26, 2011
1 parent b49a119 commit c15108c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions actionpack/lib/action_view/helpers/asset_paths.rb
Expand Up @@ -18,7 +18,7 @@ def initialize(config, controller)
# asset host, if configured, with the correct request protocol.
def compute_public_path(source, dir, ext = nil, include_host = true)
source = source.to_s
return source if is_uri?(source) || is_scheme_relative_uri?(source)
return source if is_uri?(source)

source = rewrite_extension(source, dir, ext) if ext
source = "/#{dir}/#{source}" unless source[0] == ?/
Expand All @@ -33,14 +33,7 @@ def compute_public_path(source, dir, ext = nil, include_host = true)
end

def is_uri?(path)
path =~ %r{^[-a-z]+://|^cid:}
end

# A URI relative to a base URI's scheme?
# See http://labs.apache.org/webarch/uri/rfc/rfc3986.html#relative-normal
# "//g" => "http://g"
def is_scheme_relative_uri?(path)
path =~ %r{^//}
path =~ %r{^[-a-z]+://|^cid:|^//}
end

private
Expand Down

0 comments on commit c15108c

Please sign in to comment.