Database is 0 Byte if Yubikey save is canceled #1680
This commit is contained in:
J-Jamet 2024-05-13 12:16:42 +02:00
parent 9e714c4192
commit 05f689913f
4 changed files with 6 additions and 12 deletions

View file

@ -779,7 +779,7 @@ open class Database {
@Throws(DatabaseOutputException::class)
fun saveData(
cacheFile: File,
databaseOutputStream: OutputStream?,
databaseOutputStream: () -> OutputStream?,
isNewLocation: Boolean,
masterCredential: MasterCredential?,
challengeResponseRetriever: (HardwareKey, ByteArray?) -> ByteArray
@ -820,7 +820,7 @@ open class Database {
}
}
// Copy from the cache to the final stream
databaseOutputStream?.use { outputStream ->
databaseOutputStream.invoke()?.use { outputStream ->
cacheFile.inputStream().use { inputStream ->
inputStream.readAllBytes { buffer ->
outputStream.write(buffer)