mirror of
https://github.com/gotson/komga.git
synced 2025-12-21 16:03:03 +01:00
fix: prevent crash during h2 cleanup if parent folder is null
This commit is contained in:
parent
4ecf20c062
commit
bd20ff67cc
1 changed files with 10 additions and 6 deletions
|
|
@ -22,14 +22,18 @@ class DatabaseMigration(
|
|||
@ExperimentalPathApi
|
||||
@PostConstruct
|
||||
fun init() {
|
||||
convertHomeDir(komgaProperties.database.file).parent.listDirectoryEntries("*.mv.db*").let { h2Files ->
|
||||
if (h2Files.isNotEmpty()) {
|
||||
logger.info { "Deleting old H2 database files" }
|
||||
h2Files.forEach {
|
||||
logger.info { "Delete: $it" }
|
||||
it.deleteIfExists()
|
||||
try {
|
||||
convertHomeDir(komgaProperties.database.file).parent?.listDirectoryEntries("*.mv.db*")?.let { h2Files ->
|
||||
if (h2Files.isNotEmpty()) {
|
||||
logger.info { "Deleting old H2 database files" }
|
||||
h2Files.forEach {
|
||||
logger.info { "Delete: $it" }
|
||||
it.deleteIfExists()
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.warn(e) { "Could not delete old H2 database files" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue