Use with form properly

This commit is contained in:
Marcin Kulik 2017-07-11 13:28:59 +02:00
parent 6c36e0de43
commit 1912534ae9
3 changed files with 4 additions and 10 deletions

View File

@ -19,9 +19,8 @@ defmodule Asciinema.FileStore do
@behaviour Asciinema.FileStore
def download_file(store_path, local_path) do
case open_file(store_path, &(:file.copy(&1, local_path))) do
{:ok, {:ok, _}} -> :ok
otherwise -> otherwise
with {:ok, {:ok, _}} <- open_file(store_path, &(:file.copy(&1, local_path))) do
:ok
end
end
end

View File

@ -6,8 +6,6 @@ defmodule Asciinema.FileStore.Cached do
with :ok <- remote_store().put_file(dst_path, src_local_path, content_type, compress),
:ok <- cache_store().put_file(dst_path, src_local_path, content_type, compress) do
:ok
else
otherwise -> otherwise
end
end
@ -25,8 +23,6 @@ defmodule Asciinema.FileStore.Cached do
:ok <- cache_store().put_file(path, tmp_path, MIME.path(path)),
:ok <- File.rm(tmp_path) do
cache_store().open_file(path, function)
else
otherwise -> otherwise
end
otherwise ->
otherwise

View File

@ -14,9 +14,8 @@ defmodule Asciinema.FileStore.S3 do
{body, opts}
end
case make_request(S3.put_object(bucket(), base_path() <> dst_path, body, opts)) do
{:ok, _} -> :ok
otherwise -> otherwise
with {:ok, _} <- make_request(S3.put_object(bucket(), base_path() <> dst_path, body, opts)) do
:ok
end
end