Skip to content

Commit

Permalink
Fix support for binaries in Arc files
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-a committed Mar 26, 2018
1 parent f382879 commit 6b7b259
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ by adding `arc_azure` to your list of dependencies in `mix.exs` (along with othe
```elixir
def deps do
[
{:arc_azure, "~> 0.1.0"},
{:arc_azure, "~> 0.1.1"},
{:arc, "~> 0.8.0"},
{:erlazure, github: "dkataskin/erlazure"},
]
Expand Down
6 changes: 5 additions & 1 deletion lib/arc/storage/azure.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ defmodule Arc.Storage.Azure do

defp upload_file(destination_dir, file) do
filename = Path.join(destination_dir, file.file_name)
ExAzure.request(:put_block_blob, [container(), filename, File.read!(file.path)])
ExAzure.request(:put_block_blob, [container(), filename, get_binary_file(file)])
end

defp get_binary_file(%{path: nil} = file), do: file.binary
defp get_binary_file(%{path: _} = file), do: File.read!(file.path)

end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule ArcAzure.MixProject do
def project do
[
app: :arc_azure,
version: "0.1.0",
version: "0.1.1",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down

0 comments on commit 6b7b259

Please sign in to comment.