Skip to content

Commit

Permalink
KTOR-7278: fixed ContentType match
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-erofeev committed Nov 5, 2024
1 parent b9f692c commit 42bddad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ktor-http/common/src/io/ktor/http/ContentTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public class ContentType private constructor(
return false
}

if (pattern.contentSubtype != "*" && !pattern.contentSubtype.equals(contentSubtype, ignoreCase = true)) {
if (pattern.contentSubtype != "*" && contentSubtype != "*"
&& !pattern.contentSubtype.equals(contentSubtype, ignoreCase = true)) {
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,7 @@ public data class HttpMultiAcceptRouteSelector(
return RouteSelectorEvaluation.Missing
}

val header = parsedHeaders.firstOrNull { header ->
contentTypes.any { ContentType.parse(header.value).match(it) }
}
val header = parsedHeaders.firstOrNull { header -> contentTypes.any { it.match(header.value) } }
if (header != null) {
return RouteSelectorEvaluation.Success(header.quality)
}
Expand Down

0 comments on commit 42bddad

Please sign in to comment.