diff --git a/lib/livebook/file_system/s3.ex b/lib/livebook/file_system/s3.ex index d128232e6..956647996 100644 --- a/lib/livebook/file_system/s3.ex +++ b/lib/livebook/file_system/s3.ex @@ -82,8 +82,14 @@ defmodule Livebook.FileSystem.S3 do end end + @personal_id Livebook.Hubs.Personal.id() + def id(_, nil), do: nil def id(nil, bucket_url), do: hashed_id(bucket_url) + + # For Personal hub we keep unprefixed ids + def id(@personal_id, bucket_url), do: hashed_id(bucket_url) + def id(hub_id, bucket_url), do: "#{hub_id}-#{hashed_id(bucket_url)}" defp hashed_id(bucket_url) do diff --git a/lib/livebook_web/live/hub/file_system_form_component.ex b/lib/livebook_web/live/hub/file_system_form_component.ex index 4f4c359f5..319ed3f1a 100644 --- a/lib/livebook_web/live/hub/file_system_form_component.ex +++ b/lib/livebook_web/live/hub/file_system_form_component.ex @@ -12,7 +12,7 @@ defmodule LivebookWeb.Hub.FileSystemFormComponent do button = button(file_system) title = title(file_system) - file_system = file_system || %FileSystem.S3{} + file_system = file_system || %FileSystem.S3{hub_id: assigns.hub.id} changeset = FileSystems.change_file_system(file_system) socket = assign(socket, assigns)