fix: skip directory entries

In OTP 27.1 or later, `:zip.unzip/2` without `:skip_directories` option returns directory entries.
However in OTP 26, passing `:skip_directories` returns a `:bad_option` error, so this option is not available for compatibility.
This commit is contained in:
kPherox 2024-11-27 15:45:14 +09:00
parent d92d6132f2
commit 3f98c8bd1b
No known key found for this signature in database
GPG key ID: C04751C2BFA2F62D

View file

@ -74,11 +74,14 @@ defmodule Pleroma.Frontend do
new_file_path = Path.join(dest, path) new_file_path = Path.join(dest, path)
new_file_path path
|> Path.dirname() |> Path.dirname()
|> then(&Path.join(dest, &1))
|> File.mkdir_p!() |> File.mkdir_p!()
File.write!(new_file_path, data) if not File.dir?(new_file_path) do
File.write!(new_file_path, data)
end
end) end)
end end
end end