Fix File System creation and ID prefix for Personal hub (#2238)

This commit is contained in:
Alexandre de Souza 2023-09-29 11:48:07 -03:00 committed by GitHub
parent 114d649524
commit d26295ce69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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)