1- /* auto-generated on 2023-02-06 08:25:59 -0500. Do not edit! */
1+ /* auto-generated on 2023-02-07 17:26:54 -0500. Do not edit! */
22// dofile: invoked with prepath=/Users/yagiz/Developer/url-parser/src, filename=ada.cpp
33/* begin file src/ada.cpp */
44#include " ada.h"
@@ -970,6 +970,13 @@ namespace ada::helpers {
970970 } while (true );
971971 }
972972 }
973+
974+ ada_really_inline void strip_trailing_spaces_from_opaque_path (ada::url& url) noexcept {
975+ if (!url.has_opaque_path ) return ;
976+ if (url.fragment .has_value ()) return ;
977+ if (url.query .has_value ()) return ;
978+ while (!url.path .empty () && url.path .back () == ' ' ) { url.path .resize (url.path .size ()-1 ); }
979+ }
973980} // namespace ada::helpers
974981
975982namespace ada {
@@ -1650,7 +1657,7 @@ namespace ada {
16501657 void url::set_hash (const std::string_view input) {
16511658 if (input.empty ()) {
16521659 fragment = std::nullopt ;
1653- // TODO: Potentially strip trailing spaces from an opaque path with this.
1660+ helpers::strip_trailing_spaces_from_opaque_path (* this );
16541661 return ;
16551662 }
16561663
@@ -1664,9 +1671,7 @@ namespace ada {
16641671 void url::set_search (const std::string_view input) {
16651672 if (input.empty ()) {
16661673 query = std::nullopt ;
1667- // Empty this’s query object’s list.
1668- // @todo Implement this if/when we have URLSearchParams.
1669- // Potentially strip trailing spaces from an opaque path with this.
1674+ helpers::strip_trailing_spaces_from_opaque_path (*this );
16701675 return ;
16711676 }
16721677
@@ -1679,10 +1684,6 @@ namespace ada {
16791684 ada::character_sets::QUERY_PERCENT_ENCODE;
16801685
16811686 query = ada::unicode::percent_encode (std::string_view (new_value), query_percent_encode_set);
1682-
1683- // Set this’s query object’s list to the result of parsing input.
1684- // @todo Implement this if/when we have URLSearchParams.
1685- return ;
16861687 }
16871688
16881689 bool url::set_pathname (const std::string_view input) {
0 commit comments