mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 16:16:34 +00:00
Better random tempdir format
This commit is contained in:
parent
ece063586b
commit
3f60d7bf64
1 changed files with 5 additions and 3 deletions
|
@ -216,13 +216,15 @@ defmodule Pleroma.User.Backup do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp tempdir do
|
defp tempdir do
|
||||||
|
rand = :crypto.strong_rand_bytes(8) |> Base.url_encode64(padding: false)
|
||||||
|
subdir = "backup-#{rand}"
|
||||||
|
|
||||||
case Config.get([__MODULE__, :tempdir]) do
|
case Config.get([__MODULE__, :tempdir]) do
|
||||||
nil ->
|
nil ->
|
||||||
System.tmp_dir!()
|
Path.join([System.tmp_dir!(), subdir])
|
||||||
|
|
||||||
path ->
|
path ->
|
||||||
rand = :crypto.strong_rand_bytes(8) |> Base.url_encode64(padding: false)
|
Path.join([path, subdir])
|
||||||
Path.join([path, rand])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue