Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path setter bug #659

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/url_aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ bool url_aggregator::set_pathname(const std::string_view input) {
}
clear_pathname();
parse_path(input);
if (checkers::begins_with(input, "//") && !has_authority() &&
if (checkers::begins_with(get_pathname(), "//") && !has_authority() &&
!has_dash_dot()) {
buffer.insert(components.pathname_start, "/.");
components.pathname_start += 2;
Expand Down
10 changes: 10 additions & 0 deletions tests/basic_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,14 @@ TYPED_TEST(basic_tests, nodejs_undici_2971) {
out->get_href(),
R"(https://non-ascii-location-header.sys.workers.dev/%EC%95%88%EB%85%95)");
SUCCEED();
}

TYPED_TEST(basic_tests, path_setter_bug) {
std::string_view base = "blob:/?";
auto base_url = ada::parse<ada::url_aggregator>(base);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto base_url = ada::parse<ada::url_aggregator>(base);
auto base_url = ada::parse<TypeParam>(base);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't do that as is. It will break the build.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok. Then maybe we shouldn't use typed_test

ASSERT_TRUE(base_url);
ASSERT_TRUE(base_url->validate());
ASSERT_TRUE(base_url->set_pathname("//.."));
ASSERT_TRUE(base_url->validate());
SUCCEED();
}
Loading