summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkPherox <kphrx@kpherox.dev>2024-11-27 15:45:14 +0900
committerkPherox <kphrx@kpherox.dev>2024-11-27 17:55:33 +0900
commit3f98c8bd1b86a87e204879da4172178173050638 (patch)
tree19576d3792c166af4980f93c6f0df0547b695e53
parentd92d6132f2acc1d123de4ced869b575e1a8e8785 (diff)
downloadpleroma-3f98c8bd1b86a87e204879da4172178173050638.tar.gz
pleroma-3f98c8bd1b86a87e204879da4172178173050638.zip
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.
-rw-r--r--lib/pleroma/frontend.ex7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pleroma/frontend.ex b/lib/pleroma/frontend.ex
index 816499917..a4f427ae5 100644
--- 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