commit a00d4d1d9daeafe47baba0e0f04a9b65ebe9ab26
parent 9000c0a5d57dbfb14f4e69900af5c3b4968d8ec5
Author: Antoine A <>
Date: Wed, 17 Dec 2025 22:07:30 +0100
ebics: overwrite existing pdf
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libeufin-ebics/src/main/kotlin/tech/libeufin/ebics/setup.kt b/libeufin-ebics/src/main/kotlin/tech/libeufin/ebics/setup.kt
@@ -88,11 +88,10 @@ fun askUserToAcceptKeys(bankKeys: BankPublicKeysFile, cfg: EbicsSetupConfig): Bo
*/
private fun makePdf(privs: ClientPrivateKeysFile, cfg: EbicsHostConfig) {
val pdf = generateKeysPdf(privs, cfg)
- val path = Path("/tmp/libeufin-ebics-keys-${Instant.now().epochSecond}.pdf")
+ val path = Path("/tmp/libeufin-ebics-keys.pdf")
try {
- path.writeBytes(pdf, StandardOpenOption.CREATE_NEW)
+ path.writeBytes(pdf, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)
} catch (e: Exception) {
- if (e is FileAlreadyExistsException) throw Exception("PDF file exists already at '$path', not overriding it")
throw Exception("Could not write PDF to '$path'", e)
}
println("PDF file with keys created at '$path'")