Skip to content

Conversation

@ygree
Copy link
Contributor

@ygree ygree commented Mar 29, 2023

What Does This Do

This is a workaround to add a / if it is missing when using split routes

PlayFramework routes compilergenerates play.api.routing.HandlerDef.path without a /. https://github.com/playframework/playframework/blob/main/dev-mode/routes-compiler/src/main/twirl/play/routes/compiler/inject/forwardsRouter.scala.twirl#L70

Motivation

Resolves #4806

Additional Notes

@ygree ygree self-assigned this Mar 29, 2023
}
if (i < path.length() && path.charAt(i) != '/' && rawPath.charAt(i) == '/') {
path = path.substring(0, i) + '/' + path.substring(i);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole logic seems very costly. Is the result cached in some way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I'll add a cache to this logic.

@ygree ygree requested a review from bantonsson March 29, 2023 20:13
@ygree ygree force-pushed the ygree/play-split-routing-fix branch from 69b692e to f30a018 Compare March 29, 2023 21:25
@ygree ygree marked this pull request as ready for review March 31, 2023 19:21
@ygree ygree requested a review from a team as a code owner March 31, 2023 19:21
@ygree ygree force-pushed the ygree/play-split-routing-fix branch from 1ff1d65 to d1bbb63 Compare March 31, 2023 19:22
@ygree ygree force-pushed the ygree/play-split-routing-fix branch from d1bbb63 to cb7af5f Compare April 1, 2023 00:15
@ygree ygree merged commit 412db16 into master Apr 3, 2023
@ygree ygree deleted the ygree/play-split-routing-fix branch April 3, 2023 15:05
@github-actions github-actions bot added this to the 1.12.0 milestone Apr 3, 2023
@richardstartin richardstartin added the inst: play framework Play Framework instrumentation label Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: play framework Play Framework instrumentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing slash(/) in akka and play request span name

4 participants