Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTOR-6671 Fix Resources: a / route isn't resolved when there is a sib… #4667

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

e5l
Copy link
Member

@e5l e5l commented Feb 12, 2025

Fix KTOR-6671 Resources: a / route isn't resolved when there is a sibling staticResources

Comment on lines +610 to +613
) = createChild(object : RouteSelector() {
override suspend fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation =
RouteSelectorEvaluation.Success(quality = RouteSelectorEvaluation.qualityTailcard)
}).apply {
Copy link
Contributor

Choose a reason for hiding this comment

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

Extracting the selector here could help with readability. Something like:

createChild(TailcardSelector).apply { /* ... */ }

// Adds lower priority to the route so that it can be used as a fallback
object TailcardSelector : RouteSelector() {
    override suspend fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation =
        RouteSelectorEvaluation.Success(quality = RouteSelectorEvaluation.qualityTailcard)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, but I want to avoid creating new API with the fix

@e5l e5l merged commit 7f0979a into main Feb 12, 2025
14 of 17 checks passed
@e5l e5l deleted the e5l/resource-to-home-page branch February 12, 2025 09:58
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