aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/repo/RepoDownloadManager.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-10-16 16:46:49 +0200
committerLinnea Gräf <nea@nea.moe>2025-10-16 16:46:49 +0200
commita2f670bc5c608f9490801ef0b0a607308fcb23da (patch)
treec922d8499f17f6a4bda367de2b8712a2e91da6ac /src/main/kotlin/repo/RepoDownloadManager.kt
parenteb565f975abd394aa7b43bea00c8df219e7831d3 (diff)
downloadFirmament-a2f670bc5c608f9490801ef0b0a607308fcb23da.tar.gz
Firmament-a2f670bc5c608f9490801ef0b0a607308fcb23da.tar.bz2
Firmament-a2f670bc5c608f9490801ef0b0a607308fcb23da.zip
fix: redirects during repo download not being followed
Diffstat (limited to 'src/main/kotlin/repo/RepoDownloadManager.kt')
-rw-r--r--src/main/kotlin/repo/RepoDownloadManager.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/kotlin/repo/RepoDownloadManager.kt b/src/main/kotlin/repo/RepoDownloadManager.kt
index 36ded5c..adbe36e 100644
--- a/src/main/kotlin/repo/RepoDownloadManager.kt
+++ b/src/main/kotlin/repo/RepoDownloadManager.kt
@@ -66,8 +66,12 @@ object RepoDownloadManager {
private suspend fun downloadGithubArchive(url: String): Path = withContext(IO) {
val response = HttpUtil.request(url)
val targetFile = Files.createTempFile("firmament-repo", ".zip")
- val outputChannel = Files.newOutputStream(targetFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE)
- response.forInputStream().await().copyTo(outputChannel)
+ Files.newOutputStream(targetFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE)
+ .use { outputStream ->
+ response.forInputStream().await().use { inputStream ->
+ inputStream.copyTo(outputStream)
+ }
+ }
targetFile
}