commit: 3f60d7bf644fc38e8e5d9f525a1675526ade0037
parent ece063586b5e2c2e8c4eb6e92e50b3dcc09d2836
Author: Mark Felder <feld@feld.me>
Date: Mon, 24 Jun 2024 22:52:21 -0400
Better random tempdir format
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/pleroma/user/backup.ex b/lib/pleroma/user/backup.ex
@@ -216,13 +216,15 @@ defmodule Pleroma.User.Backup do
end
defp tempdir do
+ rand = :crypto.strong_rand_bytes(8) |> Base.url_encode64(padding: false)
+ subdir = "backup-#{rand}"
+
case Config.get([__MODULE__, :tempdir]) do
nil ->
- System.tmp_dir!()
+ Path.join([System.tmp_dir!(), subdir])
path ->
- rand = :crypto.strong_rand_bytes(8) |> Base.url_encode64(padding: false)
- Path.join([path, rand])
+ Path.join([path, subdir])
end
end