Skip to content

Commit e988790

Browse files
authored
Sanitize empty strings when getting Proxy Environment variables (#92)
1 parent 2bf28d7 commit e988790

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/tailwind.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,18 @@ defmodule Tailwind do
390390
defp fallback(:inet6), do: :inet
391391

392392
defp proxy_for_scheme("http") do
393-
System.get_env("HTTP_PROXY") || System.get_env("http_proxy")
393+
get_and_sanitize_env_var("HTTP_PROXY") || get_and_sanitize_env_var("http_proxy")
394394
end
395395

396396
defp proxy_for_scheme("https") do
397-
System.get_env("HTTPS_PROXY") || System.get_env("https_proxy")
397+
get_and_sanitize_env_var("HTTPS_PROXY") || get_and_sanitize_env_var("https_proxy")
398+
end
399+
400+
defp get_and_sanitize_env_var(env_var) do
401+
case String.trim(System.get_env(env_var, "")) do
402+
"" -> nil
403+
trimmed -> trimmed
404+
end
398405
end
399406

400407
defp maybe_add_proxy_auth(http_options, scheme) do

0 commit comments

Comments
 (0)