Environment
Erlang/OTP 23 [erts-11.1.5] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe]
Elixir 1.12.3 (compiled with Erlang/OTP 22)
waffle 1.1.5
waffle_ecto 0.0.11
Issue
I am not sure if this is an actual bug or I misunderstand the role of storage_dir config.
Round about I have the following code:
config :waffle,
storage: Waffle.Storage.Local,
asset_host: "",
storage_dir: "storage"
defmodule Storage.ProfileFile do
use Waffle.Definition
use Waffle.Ecto.Definition
@versions [:original]
def storage_dir(_version, {_file, profile}) do
"profiles/#{profile.id}"
end
end
Storage.ProfileFile.store({
%Plug.Upload{
filename: file_name,
path: meta.path
},
%{id: profile_file.profile_id}
})
Expected behavior
I would expect the newly uploaded file is saved in storage/profiles/<SOME_ID>/FILENAME.EXT
Actual behavior
The newly uploaded file is actually saved in profiles/<SOME_ID>/FILENAME.EXT