Skip to content

Conversation

@gwicke
Copy link
Member

@gwicke gwicke commented Nov 17, 2016

A wildcard match like /some{/foo} or /some/{+bar} should match even if
the optional component is empty (ex: request for /some/). {+bar} should
also match arbitrary paths ending on a slash (ex: /some/path/).

A wildcard match like /some{/foo} or /some/{+bar} should match even if
the optional component is empty (ex: request for /some/). {+bar} should
also match arbitrary paths ending on a slash (ex: /some/path/).
@gwicke
Copy link
Member Author

gwicke commented Nov 17, 2016

/cc @wikimedia/services

@gwicke
Copy link
Member Author

gwicke commented Nov 17, 2016

This fixes an issue I ran into while testing node-serviceworker-proxy, where requests for URLs ending in slash would return an empty path listing instead of hitting the serviceworker.

@Pchelolo
Copy link
Contributor

Pchelolo commented Nov 17, 2016

Looks good. We won't be able to distinguish /foo/ and /foo{/bar} any more, but I guess it's ok

@gwicke
Copy link
Member Author

gwicke commented Nov 17, 2016

/foo/ and /foo{/bar} can still be different routes if they are explicitly defined. The change here only affects the case where nothing is explicitly registered for /foo/.

@Pchelolo
Copy link
Contributor

@gwicke Right, just since now /foo/ has to be placed before /foo{/bar}. LGTM anyway

@Pchelolo Pchelolo merged commit eb79f70 into wikimedia:master Nov 17, 2016
@gwicke
Copy link
Member Author

gwicke commented Nov 17, 2016

@gwicke Right, just since now /foo/ has to be placed before /foo{/bar}.

Yeah, that's a good point. I tried to generally order things a while ago in order to make this deterministic, but IIRC that didn't work out so easily.

@Pchelolo
Copy link
Contributor

We don't have cases like this anyway, so we're fine.

@gwicke
Copy link
Member Author

gwicke commented Nov 17, 2016

Published & tagged.

gwicke added a commit to gwicke/restbase-mod-table-spec that referenced this pull request Nov 17, 2016
wikimedia/swagger-router#51 changed the handling
of overlapping routes ending in a slash. As a result, we now need to
list the higher level route first, to avoid conflicts during tree
construction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants