You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pubfnpath_colon_params(s:&str) -> Cow<str>{// if !s.contains(':') {// return s.into();// }letmut rewritten = String::with_capacity(s.len());#[derive(Clone,Copy)]enumState{None,// this state is no longer needed?// WasParam,WasWildcard,}letmut state = State::None;let chars_pair = s.chars().zip(s.chars().skip(1));letmut do_escape_next = false;// look at https://github.com/ibraheemdev/matchit/blob/36e5398589129896c5dad8a6b2580ede59831875/src/escape.rs#L18for(i,(c, c_next))in chars_pair.enumerate(){if do_escape_next {
do_escape_next = false;continue;}if(c == '{' && c_next == '{') || (c == '}' && c_next == '}'){// This poses a problem when the url have '{' or '}' escaped not sure how and where to handle this
rewritten.push(c);// skip the next iteration
do_escape_next = true;continue;}match(state, c, c_next){(State::None,'{','*') => {
rewritten.push('{');
state = State::WasWildcard;}// This is if, a normal Param is allowed after a wildcard// (not sure but I think this is a planned feature in the future?)(State::WasWildcard, _,'}') => {
rewritten.push(c);
rewritten += "+}";
state = State::None;}(_, _, _) => {
rewritten.push(c);}}if i == s.len() - 2{
rewritten.push(c_next);}}
rewritten.into()}
I haven't tested this fully, especially wildcards params, but tested it briefly on:
The new syntax is almost the same except we still need to convert the end if it is {*...} To {...+}.
Code should be:
1: get substring after last /
2: if it starts with {* and ends with } copy string until last / and append contents as { content +} else just return original string.
The new matching syntax breaks
path_colon_params
in:aide/crates/aide/src/util.rs
Line 23 in 7e2d71e
This is my, not so good, idea to fix it:
I haven't tested this fully, especially wildcards params, but tested it briefly on:
The text was updated successfully, but these errors were encountered: