Skip to content

Commit

Permalink
Merge pull request #29 from starkbank/fix/url-encode-plus
Browse files Browse the repository at this point in the history
Fix URL utils to encode "+" character
  • Loading branch information
cdottori-stark authored Mar 19, 2021
2 parents 6d8070d + 7f3d90c commit 5cc33d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Fixed
- "+" character bug in BrcodePreview

## [2.4.0] - 2021-01-21
### Added
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/url.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ defmodule StarkBank.Utils.URL do
list =
for {k, v} <- query |> API.cast_json_to_api_format(),
!is_nil(v),
do: "#{k |> query_key}=#{v |> query_argument}"
do: {k |> query_key, v |> query_argument}

if length(list) > 0 do
endpoint ++ to_charlist("?" <> String.replace(Enum.join(list, "&"), " ", "%20"))
endpoint ++ '?' ++ to_charlist(URI.encode_query(list))
else
endpoint
end
Expand Down

0 comments on commit 5cc33d9

Please sign in to comment.