diff options
author | Lain Soykaf <lain@lain.com> | 2025-03-01 17:45:28 +0400 |
---|---|---|
committer | Lain Soykaf <lain@lain.com> | 2025-03-01 17:45:28 +0400 |
commit | 32acdf0936847870657fb265e02c56c1273378e0 (patch) | |
tree | 6350d15a98b971d2c581c9d239d50617dd7be97a /lib/pleroma/frontend.ex | |
parent | a8e863e0d627b6ed9563d953ee2cc8c9f4c9ee7a (diff) | |
parent | 13a88bd1a5a13c771d33d327d54125c68bbb9cb3 (diff) | |
download | pleroma-32acdf0936847870657fb265e02c56c1273378e0.tar.gz pleroma-32acdf0936847870657fb265e02c56c1273378e0.zip |
Merge branch 'security-2.9' into release/2.9.0
Diffstat (limited to 'lib/pleroma/frontend.ex')
-rw-r--r-- | lib/pleroma/frontend.ex | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/lib/pleroma/frontend.ex b/lib/pleroma/frontend.ex index a4f427ae5..fe7f525ea 100644 --- a/lib/pleroma/frontend.ex +++ b/lib/pleroma/frontend.ex @@ -65,24 +65,12 @@ defmodule Pleroma.Frontend do end def unzip(zip, dest) do - with {:ok, unzipped} <- :zip.unzip(zip, [:memory]) do - File.rm_rf!(dest) - File.mkdir_p!(dest) - - Enum.each(unzipped, fn {filename, data} -> - path = filename - - new_file_path = Path.join(dest, path) - - path - |> Path.dirname() - |> then(&Path.join(dest, &1)) - |> File.mkdir_p!() + File.rm_rf!(dest) + File.mkdir_p!(dest) - if not File.dir?(new_file_path) do - File.write!(new_file_path, data) - end - end) + case Pleroma.SafeZip.unzip_data(zip, dest) do + {:ok, _} -> :ok + error -> error end end |