From 09c7248a5e7d308af95edd2feb61b812592498b1 Mon Sep 17 00:00:00 2001 From: speeddragon Date: Wed, 8 Jul 2026 12:28:30 +0100 Subject: [PATCH 1/2] fix: Allow to access path inside manifest that contains spaces --- src/core/resolver/hb_singleton.erl | 2 +- src/preloaded/arweave/dev_manifest.erl | 35 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/core/resolver/hb_singleton.erl b/src/core/resolver/hb_singleton.erl index 04de744f8..58f05a6d4 100644 --- a/src/core/resolver/hb_singleton.erl +++ b/src/core/resolver/hb_singleton.erl @@ -339,7 +339,7 @@ parse_part(Part, Opts) -> case maybe_subpath(Part, Opts) of {resolve, Subpath} -> {resolve, Subpath}; Part -> - case part([$&, $~, $+, $ , $=], Part) of + case part([$&, $~, $+, $=], Part) of {no_match, PartKey, <<>>} when ?IS_ID(PartKey) -> PartKey; {no_match, PartKey, <<>>} -> diff --git a/src/preloaded/arweave/dev_manifest.erl b/src/preloaded/arweave/dev_manifest.erl index 1f70d9dda..286209e5a 100644 --- a/src/preloaded/arweave/dev_manifest.erl +++ b/src/preloaded/arweave/dev_manifest.erl @@ -292,6 +292,41 @@ manifest_404_error_test_parallel() -> ), ok. +manifest_path_with_spaces_test_parallel() -> + Opts = #{ <<"store">> => hb_opts:get(store, no_viable_store, #{}) }, + Page = #{ + <<"content-type">> => <<"image/png">>, + <<"body">> => <<"Page With Spaces">> + }, + {ok, PageID} = hb_cache:write(Page, Opts), + IndexPage = #{ + <<"content-type">> => <<"text/html">>, + <<"body">> => <<"Index Page">> + }, + {ok, IndexID} = hb_cache:write(IndexPage, Opts), + Manifest = #{ + <<"paths">> => #{ + <<"ID With Spaces.png">> => #{ <<"id">> => PageID }, + <<"index.html">> => #{ <<"id">> => IndexID } + }, + <<"index">> => #{ <<"path">> => <<"index.html">> } + }, + ManifestMsg = #{ + <<"device">> => <<"manifest@1.0">>, + <<"body">> => hb_json:encode(Manifest) + }, + {ok, ManifestID} = hb_cache:write(ManifestMsg, Opts), + Node = hb_http_server:start_node(Opts), + ?assertMatch( + {ok, #{ <<"body">> := <<"Page With Spaces">> }}, + hb_http:get( + Node, + << ManifestID/binary, "/ID%20With%20Spaces.png" >>, + Opts + ) + ), + ok. + create_generic_manifest(Opts) -> IndexPage = #{ <<"content-type">> => <<"text/html">>, From 9702f94383e136c7967d389866674b6f261dc079 Mon Sep 17 00:00:00 2001 From: speeddragon Date: Wed, 8 Jul 2026 18:48:12 +0100 Subject: [PATCH 2/2] impr: Add extra test to test + inside a key value --- src/core/resolver/hb_singleton.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/resolver/hb_singleton.erl b/src/core/resolver/hb_singleton.erl index 58f05a6d4..b5aa97035 100644 --- a/src/core/resolver/hb_singleton.erl +++ b/src/core/resolver/hb_singleton.erl @@ -718,6 +718,12 @@ typed_key_test() -> ?assertEqual(123, hb_maps:get(<<"test-key">>, Msg2, not_found)), ?assertEqual(not_found, hb_maps:get(<<"test-key">>, Res, not_found)). +query_string_plus_value_decodes_to_space_test() -> + Msgs = from(<<"/a?key=8+8">>, #{}), + ?assertEqual(2, length(Msgs)), + [_, Msg] = Msgs, + ?assertEqual(<<"8 8">>, hb_maps:get(<<"key">>, Msg)). + subpath_in_key_test() -> Req = #{ <<"path">> => <<"/a/b/c">>,