Skip to content

Commit

Permalink
Merge branch 'kuba/stdlib/fix_normalize_undefined_path_crash/OTP-1926…
Browse files Browse the repository at this point in the history
…6' into maint-27

* kuba/stdlib/fix_normalize_undefined_path_crash/OTP-19266:
  stdlib: fix normalize missing path crash
  • Loading branch information
Erlang/OTP committed Oct 17, 2024
2 parents 676938e + 2002917 commit 7691102
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/stdlib/src/uri_string.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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)}.


Expand Down
8 changes: 7 additions & 1 deletion lib/stdlib/test/uri_string_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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"} =
Expand Down

0 comments on commit 7691102

Please sign in to comment.