Skip to content

Commit c1a4988

Browse files
committed
Better parsing of user-provided URL
1 parent 386aa66 commit c1a4988

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/components_guide_web/live/latency_comparison.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ defmodule ComponentsGuideWeb.LatencyComparisonLive do
136136
urls = socket.assigns[:default_urls]
137137

138138
urls =
139-
case URI.new(user_url) do
140-
{:ok, %URI{host: ""}} -> urls
139+
case URI.new(String.trim(user_url)) do
141140
{:ok, uri = %URI{host: host, port: 443}} when is_binary(host) -> [to_string(uri) | urls]
142141
_ -> urls
143142
end

0 commit comments

Comments
 (0)