Skip to content

Commit

Permalink
word
Browse files Browse the repository at this point in the history
  • Loading branch information
tanfarming committed May 20, 2024
1 parent 81cc6b5 commit 10b621f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/ret/storage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ defmodule Ret.Storage do
search_string,
replacement_string
) do
{:ok, %{"content_type" => content_type}, file_stream} = fetch(owned_file)

file_stream
|> Enum.to_list()
|> Enum.join("")
|> String.replace(search_string, replacement_string)
|> store_string_as_owned_file(content_type, account)
case fetch(owned_file) do
{:ok, %{"content_type" => content_type}, file_stream} ->
file_stream
|> Enum.to_list()
|> Enum.join("")
|> String.replace(search_string, replacement_string)
|> store_string_as_owned_file(content_type, account)

{:error, reason} ->
# Print a warning and ignore the error
IO.warn("Failed to fetch the file: #{inspect(reason)}")
:ignore
end
end

def fetch(id, key) when is_binary(id) and is_binary(key) do
Expand Down

0 comments on commit 10b621f

Please sign in to comment.