File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 6
6
* [ #2573 ] ( https://github.com/ruby-grape/grape/pull/2573 ) : Clean up deprecated code - [ @ericproulx ] ( https://github.com/ericproulx ) .
7
7
* [ #2575 ] ( https://github.com/ruby-grape/grape/pull/2575 ) : Refactor Api description class - [ @ericproulx ] ( https://github.com/ericproulx ) .
8
8
* [ #2577 ] ( https://github.com/ruby-grape/grape/pull/2577 ) : Deprecate ` return ` in endpoint execution - [ @ericproulx ] ( https://github.com/ericproulx ) .
9
- * [ #13 ] ( https://github.com/ericproulx/grape/pull/13 ) : Refactor endpoint helpers and error middleware integration - [ @ericproulx ] ( https://github.com/ericproulx ) .
9
+ * [ #2580 ] ( https://github.com/ruby-grape/grape/pull/2580 ) : Refactor endpoint helpers and error middleware integration - [ @ericproulx ] ( https://github.com/ericproulx ) .
10
+ * [ #2582 ] ( https://github.com/ruby-grape/grape/pull/2582 ) : Fix leaky slash when normalizing - [ @ericproulx ] ( https://github.com/ericproulx ) .
10
11
* Your contribution here.
11
12
12
13
#### Fixes
Original file line number Diff line number Diff line change @@ -12,10 +12,11 @@ class Router
12
12
# normalize_path("/%ab") # => "/%AB"
13
13
# https://github.com/rails/rails/blob/00cc4ff0259c0185fe08baadaa40e63ea2534f6e/actionpack/lib/action_dispatch/journey/router/utils.rb#L19
14
14
def self . normalize_path ( path )
15
- return +'/' unless path
15
+ return '/' unless path
16
+ return path if path == '/'
16
17
17
18
# Fast path for the overwhelming majority of paths that don't need to be normalized
18
- return path . dup if path == '/' || ( path . start_with? ( '/' ) && !( path . end_with? ( '/' ) || path . match? ( %r{%|//} ) ) )
19
+ return path . dup if path . start_with? ( '/' ) && !( path . end_with? ( '/' ) || path . match? ( %r{%|//} ) )
19
20
20
21
# Slow path
21
22
encoding = path . encoding
You can’t perform that action at this time.
0 commit comments