mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 09:03:02 +08:00
Fix double slashes in URL for new
(#1013)
* Fix double slashes in URL for `new` * Fix formatting * Rename to append_path/2 to set_path/2
This commit is contained in:
parent
fb9c4fbef8
commit
4fac98e069
1 changed files with 4 additions and 4 deletions
|
@ -139,7 +139,7 @@ defmodule LivebookCLI.Server do
|
|||
defp check_endpoint_availability(base_url) do
|
||||
Application.ensure_all_started(:inets)
|
||||
|
||||
health_url = append_path(base_url, "/public/health")
|
||||
health_url = set_path(base_url, "/public/health")
|
||||
|
||||
case Livebook.Utils.HTTP.request(:get, health_url) do
|
||||
{:ok, status, _headers, body} ->
|
||||
|
@ -162,7 +162,7 @@ defmodule LivebookCLI.Server do
|
|||
|
||||
defp open_from_args(base_url, ["new"]) do
|
||||
base_url
|
||||
|> append_path("/explore/notebooks/new")
|
||||
|> set_path("/explore/notebooks/new")
|
||||
|> Livebook.Utils.browser_open()
|
||||
end
|
||||
|
||||
|
@ -276,10 +276,10 @@ defmodule LivebookCLI.Server do
|
|||
|
||||
defp opts_to_config([_opt | opts], config), do: opts_to_config(opts, config)
|
||||
|
||||
defp append_path(url, path) do
|
||||
defp set_path(url, path) do
|
||||
url
|
||||
|> URI.parse()
|
||||
|> Map.update!(:path, &((&1 || "") <> path))
|
||||
|> Map.put(:path, path)
|
||||
|> URI.to_string()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue