Skip to content

Commit 62abc7a

Browse files
committed
fix: handle opaque url search setter
1 parent 956d015 commit 62abc7a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/url-setters.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ namespace ada {
5050
void url::set_search(const std::string_view input) {
5151
if (input.empty()) {
5252
query = std::nullopt;
53-
// Empty this’s query object’s list.
54-
// @todo Implement this if/when we have URLSearchParams.
55-
// Potentially strip trailing spaces from an opaque path with this.
53+
if (has_opaque_path) {
54+
size_t non_whitespace_location = path.find_first_of(' ');
55+
if (non_whitespace_location != std::string_view::npos) {
56+
path = path.substr(0, non_whitespace_location);
57+
}
58+
}
5659
return;
5760
}
5861

0 commit comments

Comments
 (0)