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! */
2
2
// dofile: invoked with prepath=/Users/yagiz/Developer/url-parser/src, filename=ada.cpp
3
3
/* begin file src/ada.cpp */
4
4
#include " ada.h"
@@ -970,6 +970,13 @@ namespace ada::helpers {
970
970
} while (true );
971
971
}
972
972
}
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
+ }
973
980
} // namespace ada::helpers
974
981
975
982
namespace ada {
@@ -1650,7 +1657,7 @@ namespace ada {
1650
1657
void url::set_hash (const std::string_view input) {
1651
1658
if (input.empty ()) {
1652
1659
fragment = std::nullopt;
1653
- // TODO: Potentially strip trailing spaces from an opaque path with this.
1660
+ helpers::strip_trailing_spaces_from_opaque_path (* this );
1654
1661
return ;
1655
1662
}
1656
1663
@@ -1664,9 +1671,7 @@ namespace ada {
1664
1671
void url::set_search (const std::string_view input) {
1665
1672
if (input.empty ()) {
1666
1673
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 );
1670
1675
return ;
1671
1676
}
1672
1677
@@ -1679,10 +1684,6 @@ namespace ada {
1679
1684
ada::character_sets::QUERY_PERCENT_ENCODE;
1680
1685
1681
1686
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 ;
1686
1687
}
1687
1688
1688
1689
bool url::set_pathname (const std::string_view input) {
0 commit comments