From d71c035669f6aa0c30aefac75e0ef2fa76d3513d Mon Sep 17 00:00:00 2001 From: davotoula Date: Thu, 25 Jun 2026 12:04:54 +0200 Subject: [PATCH] fix(napplet): log failed temp-file cleanup in NappletBlobCache.put --- .../vitorpamplona/amethyst/napplethost/NappletBlobCache.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletBlobCache.kt b/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletBlobCache.kt index 9c2afc23c2..a0b2636a65 100644 --- a/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletBlobCache.kt +++ b/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletBlobCache.kt @@ -21,6 +21,7 @@ package com.vitorpamplona.amethyst.napplethost import com.vitorpamplona.quartz.nip01Core.core.toHexKey +import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.sha256.sha256 import java.io.File @@ -54,7 +55,9 @@ class NappletBlobCache( dir.mkdirs() val tmp = File(dir, "$sha256.tmp.${System.nanoTime()}") tmp.writeBytes(bytes) - if (!tmp.renameTo(target)) tmp.delete() + if (!tmp.renameTo(target) && !tmp.delete()) { + Log.w("NappletBlobCache") { "Failed to delete leftover temp file ${tmp.absolutePath} after a failed rename" } + } } }