mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[http-client, okHttp] IJPL-179625 UrlPksParser can produce equal values for scheme and authority
GitOrigin-RevId: f9b09cc9c9ab25f232754fc3da72c64e04a58c9d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ecbc314654
commit
6a2baf2c5a
@@ -220,9 +220,14 @@ fun UrlPathContext.applyFromParsed(parsedUrl: UrlPksParser.ParsedPksUrl,
|
||||
auth: Boolean = true,
|
||||
path: Boolean = true): UrlPathContext {
|
||||
var result = this
|
||||
if (scheme) result = parsedUrl.scheme?.valueIfKnown?.takeIf { it.isNotEmpty() }?.let { result.withSchemes(setOf(it)) } ?: result
|
||||
if (auth) result = parsedUrl.authority?.valueIfKnown?.let { result.withAuthorities(setOf(it)) } ?: result
|
||||
if (path) result = parsedUrl.urlPath.let { result.subContext(it) }
|
||||
val authorityValue = parsedUrl.authority?.valueIfKnown?.takeIf { it.isNotEmpty() }
|
||||
val schemeValue = parsedUrl.scheme?.valueIfKnown?.takeIf { it.isNotEmpty() && it != authorityValue }
|
||||
val urlPath = parsedUrl.urlPath
|
||||
|
||||
if (scheme) result = schemeValue?.let { result.withSchemes(setOf(it)) } ?: result
|
||||
if (auth) result = authorityValue?.let { result.withAuthorities(setOf(it)) } ?: result
|
||||
if (path) result = urlPath.let { result.subContext(it) }
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user