Skip to content
  • edogawaconan's avatar
    8a067640
    Make URL escaping more consistent · 8a067640
    edogawaconan authored
    1. Escape '%' characters in URLs - only unescaped data
       should be passed to URL helpers
    
    2. Add an `escape_segment` helper to `Router::Utils`
       that escapes '/' characters
    
    3. Use `escape_segment` rather than `escape_fragment`
       in optimized URL generation
    
    4. Use `escape_segment` rather than `escape_path`
       in URL generation
    
    For point 4 there are two exceptions. Firstly, when a route uses wildcard
    segments (e.g. *foo) then we use `escape_path` as the value may contain '/'
    characters. This means that wildcard routes can't be optimized. Secondly,
    if a `:controller` segment is used in the path then this uses `escape_path`
    as the controller may be namespaced.
    
    Fixes #14629, #14636 and #14070.
    
    Cherry picked from:
      e2ef83f8
      a6179257
      5460591f
    
    Conflicts:
    	actionpack/CHANGELOG.md
    8a067640
    Make URL escaping more consistent
    edogawaconan authored
    1. Escape '%' characters in URLs - only unescaped data
       should be passed to URL helpers
    
    2. Add an `escape_segment` helper to `Router::Utils`
       that escapes '/' characters
    
    3. Use `escape_segment` rather than `escape_fragment`
       in optimized URL generation
    
    4. Use `escape_segment` rather than `escape_path`
       in URL generation
    
    For point 4 there are two exceptions. Firstly, when a route uses wildcard
    segments (e.g. *foo) then we use `escape_path` as the value may contain '/'
    characters. This means that wildcard routes can't be optimized. Secondly,
    if a `:controller` segment is used in the path then this uses `escape_path`
    as the controller may be namespaced.
    
    Fixes #14629, #14636 and #14070.
    
    Cherry picked from:
      e2ef83f8
      a6179257
      5460591f
    
    Conflicts:
    	actionpack/CHANGELOG.md
Loading