From 5d46f2a1979f67287723576254f8ba6911046bfe Mon Sep 17 00:00:00 2001 From: Mitchell Syer Date: Sun, 5 Jul 2026 14:23:15 -0400 Subject: [PATCH] Use temporary file for H2 migration tools download (#2169) --- CHANGELOG.md | 2 +- .../kotlin/suwayomi/tachidesk/server/database/H2Migration.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d35d456b9..24d56a312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Manga/API**) Return partial responses for Manga And Chapters query ### Fixed -- . +- (**Database/H2**) Use temporary file for H2 migration tools download ## [v2.3.2232] - 2026-07-03 diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/database/H2Migration.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/database/H2Migration.kt index 9e828ecd6..27cc62c86 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/database/H2Migration.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/database/H2Migration.kt @@ -130,9 +130,12 @@ object H2Migration { ) } - output.outputStream().use { out -> + val tmp = output.resolveSibling(output.name + ".tmp") + tmp.outputStream().use { out -> response.body.byteStream().copyTo(out) } + tmp.copyTo(output) + tmp.deleteExisting() } logger.info { "Saved: ${output.absolutePathString()}" }