diff --git a/lib/stdlib/src/uri_string.erl b/lib/stdlib/src/uri_string.erl index f9bca8e6473c..614e6eca7d3c 100644 --- a/lib/stdlib/src/uri_string.erl +++ b/lib/stdlib/src/uri_string.erl @@ -2734,7 +2734,7 @@ to_lower(<<>>, Acc) -> %% 6.2.2.3. Path Segment Normalization %% 5.2.4. Remove Dot Segments normalize_path_segment(Map) -> - Path = maps:get(path, Map, undefined), + Path = maps:get(path, Map, <<>>), Map#{path => remove_dot_segments(Path)}. diff --git a/lib/stdlib/test/uri_string_SUITE.erl b/lib/stdlib/test/uri_string_SUITE.erl index da180ca00e19..6ddefd08e5ad 100644 --- a/lib/stdlib/test/uri_string_SUITE.erl +++ b/lib/stdlib/test/uri_string_SUITE.erl @@ -1073,7 +1073,13 @@ normalize_map(_Config) -> host => <<"localhost">>}), <<"yeti://localhost">> = uri_string:normalize(#{scheme => <<"yeti">>,port => undefined,path => <<>>, - host => <<"localhost">>}). + host => <<"localhost">>}), + <<"yeti://localhost">> = + uri_string:normalize(#{scheme => <<"yeti">>,port => undefined, + host => <<"localhost">>}), + "yeti://localhost" = + uri_string:normalize(#{scheme => "yeti",port => undefined, + host => "localhost"}). normalize_return_map(_Config) -> #{scheme := "http",path := "/a/g",host := "localhost-örebro"} =