mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-11-11 06:32:23 +08:00
Fix Teams app deployments with attachment files
This commit is contained in:
parent
102161090b
commit
2a6c52b000
2 changed files with 5 additions and 0 deletions
|
|
@ -58,6 +58,8 @@ defimpl Livebook.Apps.AppSpec, for: Livebook.Apps.TeamsAppSpec do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp unzip(archive_binary, files_tmp_path) do
|
defp unzip(archive_binary, files_tmp_path) do
|
||||||
|
File.mkdir_p!(files_tmp_path)
|
||||||
|
|
||||||
case :zip.extract(archive_binary, [:memory]) do
|
case :zip.extract(archive_binary, [:memory]) do
|
||||||
{:ok, entries} ->
|
{:ok, entries} ->
|
||||||
Enum.reduce_while(entries, {:error, "notebook file missing in the app archive"}, fn
|
Enum.reduce_while(entries, {:error, "notebook file missing in the app archive"}, fn
|
||||||
|
|
|
||||||
|
|
@ -633,12 +633,15 @@ defmodule Livebook.Hubs.TeamClientTest do
|
||||||
notebook = %{
|
notebook = %{
|
||||||
Livebook.Notebook.new()
|
Livebook.Notebook.new()
|
||||||
| app_settings: %{Livebook.Notebook.AppSettings.new() | slug: slug},
|
| app_settings: %{Livebook.Notebook.AppSettings.new() | slug: slug},
|
||||||
|
file_entries: [%{type: :attachment, name: "image.jpg"}],
|
||||||
name: title,
|
name: title,
|
||||||
hub_id: team.id,
|
hub_id: team.id,
|
||||||
deployment_group_id: deployment_group_id
|
deployment_group_id: deployment_group_id
|
||||||
}
|
}
|
||||||
|
|
||||||
files_dir = Livebook.FileSystem.File.local(tmp_dir)
|
files_dir = Livebook.FileSystem.File.local(tmp_dir)
|
||||||
|
image_file = Livebook.FileSystem.File.resolve(files_dir, "image.jpg")
|
||||||
|
:ok = Livebook.FileSystem.File.write(image_file, "content")
|
||||||
|
|
||||||
{:ok, %Livebook.Teams.AppDeployment{file: zip_content} = app_deployment} =
|
{:ok, %Livebook.Teams.AppDeployment{file: zip_content} = app_deployment} =
|
||||||
Livebook.Teams.AppDeployment.new(notebook, files_dir)
|
Livebook.Teams.AppDeployment.new(notebook, files_dir)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue