mirror of
https://github.com/gotson/komga.git
synced 2025-12-22 00:13:30 +01:00
refactor: use ifBlank instead of if isBlank
This commit is contained in:
parent
55b6e86326
commit
94a1f706c8
3 changed files with 4 additions and 8 deletions
|
|
@ -56,7 +56,7 @@ class ComicInfoProvider(
|
|||
comicInfo.publisher,
|
||||
comicInfo.ageRating?.ageRating,
|
||||
releaseDate,
|
||||
if (authors.isEmpty()) null else authors,
|
||||
authors.ifEmpty { null },
|
||||
SeriesMetadataPatch(
|
||||
comicInfo.series,
|
||||
comicInfo.series,
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ class EpubMetadataProvider(
|
|||
val authors = opf.select("metadata > dc|creator")
|
||||
.map {
|
||||
val name = it.text()
|
||||
val opfRole = it.attr("opf|role").orNull()
|
||||
val id = it.attr("id").orNull()
|
||||
val opfRole = it.attr("opf|role").ifBlank { null }
|
||||
val id = it.attr("id").ifBlank { null }
|
||||
val refineRole = creatorRefines[id]
|
||||
val role = opfRole ?: refineRole
|
||||
Author(name, relators[role] ?: "writer")
|
||||
|
|
@ -75,8 +75,6 @@ class EpubMetadataProvider(
|
|||
return null
|
||||
}
|
||||
|
||||
private fun String.orNull() = if (isBlank()) null else this
|
||||
|
||||
private fun parseDate(date: String): LocalDate? =
|
||||
try {
|
||||
LocalDate.parse(date, DateTimeFormatter.ISO_DATE)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ import javax.servlet.ServletContext
|
|||
class IndexController(
|
||||
servletContext: ServletContext
|
||||
) {
|
||||
private val baseUrl: String =
|
||||
if (servletContext.contextPath.isBlank()) "/"
|
||||
else "${servletContext.contextPath}/"
|
||||
private val baseUrl: String = "${servletContext.contextPath}/"
|
||||
|
||||
@GetMapping("/")
|
||||
fun index(model: Model): String {
|
||||
|
|
|
|||
Loading…
Reference in a new issue