commit: 3f98c8bd1b86a87e204879da4172178173050638
parent d92d6132f2acc1d123de4ced869b575e1a8e8785
Author: kPherox <kphrx@kpherox.dev>
Date: Wed, 27 Nov 2024 15:45:14 +0900
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.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/pleroma/frontend.ex b/lib/pleroma/frontend.ex
@@ -74,11 +74,14 @@ defmodule Pleroma.Frontend do
new_file_path = Path.join(dest, path)
- new_file_path
+ path
|> Path.dirname()
+ |> then(&Path.join(dest, &1))
|> 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