Skip to content

Commit

Permalink
Fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
marychatte committed May 30, 2024
1 parent c901312 commit d47f1e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ktor-http/common/src/io/ktor/http/FileContentType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ private val extensionsByContentType: Map<ContentType, List<String>> by lazy {
internal fun List<ContentType>.selectDefault(): ContentType {
val contentType = firstOrNull() ?: ContentType.Application.OctetStream
return when {
contentType.match(ContentType.Text.Any) && contentType.charset() == null -> contentType.withCharset(Charsets.UTF_8)
contentType.match(ContentType.Image.SVG) && contentType.charset() == null -> contentType.withCharset(Charsets.UTF_8)
contentType.match(ContentType.Text.Any)
&& contentType.charset() == null -> contentType.withCharset(Charsets.UTF_8)

contentType.match(ContentType.Image.SVG)
&& contentType.charset() == null -> contentType.withCharset(Charsets.UTF_8)

else -> contentType
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ class StaticContentTest {
}

extensions.forEach { (extension, contentType) ->
client.get("/${fileName}.${extension}").apply {
client.get("/$fileName.$extension").apply {
assertEquals(contentType.withCharset(Charsets.UTF_8), contentType())
}
}
Expand Down

0 comments on commit d47f1e2

Please sign in to comment.