Skip to content

Commit

Permalink
fix: don't crash on connection strings with trailing semicolons (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobht authored Apr 23, 2024
2 parents ba56d81 + a376f48 commit 8f2e27c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Don't crash on connection strings with trailing semicolon

---

## 1.1.0
Expand Down
5 changes: 4 additions & 1 deletion lib/azurex/blob/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ defmodule Azurex.Blob.Config do
iex> parse_connection_string("Key=value")
%{"Key" => "value"}
iex> parse_connection_string("Key=value;")
%{"Key" => "value"}
iex> parse_connection_string("Key1=hello;Key2=world")
%{"Key1" => "hello", "Key2" => "world"}
Expand All @@ -85,7 +88,7 @@ defmodule Azurex.Blob.Config do

def parse_connection_string(connection_string) do
connection_string
|> String.split(";")
|> String.split(";", trim: true)
|> Enum.map(&String.split(&1, "=", parts: 2))
|> Map.new(fn [key, value] -> {key, value} end)
end
Expand Down

0 comments on commit 8f2e27c

Please sign in to comment.