Fix Teams app deployments with attachment files

This commit is contained in:
Jonatan Kłosko 2024-10-05 03:10:37 +08:00
parent 50b60f0a4f
commit 57ef44278b
2 changed files with 5 additions and 0 deletions

View file

@ -58,6 +58,8 @@ defimpl Livebook.Apps.AppSpec, for: Livebook.Apps.TeamsAppSpec do
end
defp unzip(archive_binary, files_tmp_path) do
File.mkdir_p!(files_tmp_path)
case :zip.extract(archive_binary, [:memory]) do
{:ok, entries} ->
Enum.reduce_while(entries, {:error, "notebook file missing in the app archive"}, fn

View file

@ -633,12 +633,15 @@ defmodule Livebook.Hubs.TeamClientTest do
notebook = %{
Livebook.Notebook.new()
| app_settings: %{Livebook.Notebook.AppSettings.new() | slug: slug},
file_entries: [%{type: :attachment, name: "image.jpg"}],
name: title,
hub_id: team.id,
deployment_group_id: deployment_group_id
}
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} =
Livebook.Teams.AppDeployment.new(notebook, files_dir)