forked from AkkomaGang/akkoma
Use Path.join/2
This commit is contained in:
parent
9af9f02f4b
commit
08972dd135
1 changed files with 4 additions and 4 deletions
|
@ -55,7 +55,7 @@ def new(user) do
|
||||||
def delete(backup) do
|
def delete(backup) do
|
||||||
uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
|
uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
|
||||||
|
|
||||||
with :ok <- uploader.delete_file("backups/" <> backup.file_name) do
|
with :ok <- uploader.delete_file(Path.join("backups", backup.file_name)) do
|
||||||
Repo.delete(backup)
|
Repo.delete(backup)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -164,7 +164,7 @@ def upload(%__MODULE__{} = backup, zip_path) do
|
||||||
name: backup.file_name,
|
name: backup.file_name,
|
||||||
tempfile: zip_path,
|
tempfile: zip_path,
|
||||||
content_type: backup.content_type,
|
content_type: backup.content_type,
|
||||||
path: "backups/" <> backup.file_name
|
path: Path.join("backups", backup.file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
with {:ok, _} <- Pleroma.Uploaders.Uploader.put_file(uploader, upload),
|
with {:ok, _} <- Pleroma.Uploaders.Uploader.put_file(uploader, upload),
|
||||||
|
@ -178,7 +178,7 @@ defp actor(dir, user) do
|
||||||
UserView.render("user.json", %{user: user})
|
UserView.render("user.json", %{user: user})
|
||||||
|> Map.merge(%{"likes" => "likes.json", "bookmarks" => "bookmarks.json"})
|
|> Map.merge(%{"likes" => "likes.json", "bookmarks" => "bookmarks.json"})
|
||||||
|> Jason.encode() do
|
|> Jason.encode() do
|
||||||
File.write(dir <> "/actor.json", json)
|
File.write(Path.join(dir, "actor.json"), json)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ defp write_header(file, name) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp write(query, dir, name, fun) do
|
defp write(query, dir, name, fun) do
|
||||||
path = dir <> "/#{name}.json"
|
path = Path.join(dir, "#{name}.json")
|
||||||
|
|
||||||
with {:ok, file} <- File.open(path, [:write, :utf8]),
|
with {:ok, file} <- File.open(path, [:write, :utf8]),
|
||||||
:ok <- write_header(file, name) do
|
:ok <- write_header(file, name) do
|
||||||
|
|
Loading…
Reference in a new issue