livebook/lib
Wojtek Mach 453eabb6d4
Fix urls on Elixir master (#647)
Before Elixir master, empty path is represented as `nil`:

    ~% asdf shell elixir 1.12.3-otp-24 ; elixir -e 'IO.inspect URI.parse("http://localhost")'
    %URI{
      authority: "localhost",
      fragment: nil,
      host: "localhost",
      path: nil,
      port: 80,
      query: nil,
      scheme: "http",
      userinfo: nil
    }

On Elixir master, it is an empty string:

    ~% asdf shell elixir git ; elixir -e 'IO.inspect URI.parse("http://localhost")'
    %URI{
      authority: "localhost",
      fragment: nil,
      host: "localhost",
      path: "",
      port: 80,
      query: nil,
      scheme: "http",
      userinfo: nil
    }

The new default, the empty string, caused a bug on this line:

    Map.update!(:path, &((&1 || "/") <> path))

because we never prepended the leading `/` and thus we ended up with
path `"health"`, not `"/health"`, which now on Elixir master crashes:

    iex> URI.parse("http://localhost") |> Map.replace!(:path, "health") |> to_string()
    ** (ArgumentError) :path in URI must be empty or an absolute path if URL has a :host, got: %URI{authority: "localhost", fragment: nil, host: "localhost", path: "health", port: 80, query: nil, scheme: "http", userinfo: nil}
        (elixir 1.13.0-dev) lib/uri.ex:863: String.Chars.URI.to_string/1
2021-10-26 16:48:17 +02:00
..
livebook Fix root directory listing on S3 when empty (#646) 2021-10-26 15:39:24 +02:00
livebook_cli Fix urls on Elixir master (#647) 2021-10-26 16:48:17 +02:00
livebook_web Type1fool-smooth-scrolling (#638) 2021-10-24 19:38:57 +02:00
livebook.ex Encapsulate compile and runtime configuration (#577) 2021-10-05 00:49:01 +02:00
livebook_cli.ex Rename litebook_cli.ex to livebook_cli.ex (#174) 2021-04-15 08:56:49 +02:00
livebook_web.ex Initial redesign (#75) 2021-03-12 11:57:01 +01:00