From 0601733f168cca5b7158d2cd4b77f6f1efcc9c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 17 Mar 2025 16:13:16 +0100 Subject: [PATCH] Remove compile-time dependency on Livebook.FileSystem.S3 --- lib/livebook/file_system/s3.ex | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/livebook/file_system/s3.ex b/lib/livebook/file_system/s3.ex index e15aef0aa..6051cc672 100644 --- a/lib/livebook/file_system/s3.ex +++ b/lib/livebook/file_system/s3.ex @@ -85,12 +85,15 @@ 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) - def id(@personal_id, bucket_url), do: hashed_id(bucket_url) - def id(hub_id, bucket_url), do: "#{hub_id}-#{hashed_id(bucket_url)}" + + def id(hub_id, bucket_url) do + if hub_id == nil or hub_id == Livebook.Hubs.Personal.id() do + hashed_id(bucket_url) + else + "#{hub_id}-#{hashed_id(bucket_url)}" + end + end defp hashed_id(bucket_url) do hash = :crypto.hash(:sha256, bucket_url)