Skip to content

Commit

Permalink
Fix accidentally renamed function
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 3, 2022
1 parent bfcc622 commit 7608ad8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.13.1-dev

### Bug fixes

* [Plug.Router] Fix regression on Plug.Router helper function accidentally renamed

## v1.13.0 (2022-02-02)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion lib/plug/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ defmodule Plug.Router do
def __route__(method, path, guards, options) do
{method, guards} = build_methods(List.wrap(method || options[:via]), guards)
{params, match, guards, post_match} = Plug.Router.Utils.build_path_clause(path, guards)
params = Plug.Router.Utils.build_path_params(params)
params = Plug.Router.Utils.build_path_params_match(params)
private = extract_merger(options, :private)
assigns = extract_merger(options, :assigns)
host_match = Plug.Router.Utils.build_host_match(options[:host])
Expand Down
6 changes: 3 additions & 3 deletions lib/plug/router/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ defmodule Plug.Router.Utils do
## Examples
iex> Plug.Router.Utils.build_path_params(["id"])
iex> Plug.Router.Utils.build_path_params_match(["id"])
[{"id", {:id, [], nil}}]
iex> Plug.Router.Utils.build_path_params(["_id"])
iex> Plug.Router.Utils.build_path_params_match(["_id"])
[]
"""
def build_path_params(params, context \\ nil) when is_list(params) do
def build_path_params_match(params, context \\ nil) when is_list(params) do
params
|> Enum.reject(&match?("_" <> _, &1))
|> Enum.map(&{&1, Macro.var(String.to_atom(&1), context)})
Expand Down

0 comments on commit 7608ad8

Please sign in to comment.