Skip to content

Commit

Permalink
Fix Teams app deployments with attachment files
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Oct 4, 2024
1 parent 50b60f0 commit 57ef442
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/livebook/apps/teams_app_spec.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/livebook_teams/hubs/team_client_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 57ef442

Please sign in to comment.