Fixed setting file extension and deleting file on exit
This commit is contained in:
parent
da84aaedf6
commit
2b3c3fa5fa
|
@ -122,8 +122,9 @@ class MailReader(
|
||||||
|
|
||||||
if (invoice != null) {
|
if (invoice != null) {
|
||||||
val filename = File(part.fileName)
|
val filename = File(part.fileName)
|
||||||
val file = File.createTempFile(filename.nameWithoutExtension, filename.extension).also { file ->
|
val file = File.createTempFile(filename.nameWithoutExtension, "." + filename.extension).also { file ->
|
||||||
part.inputStream.use { it.copyTo(file.outputStream()) }
|
part.inputStream.use { it.copyTo(file.outputStream()) }
|
||||||
|
file.deleteOnExit()
|
||||||
}
|
}
|
||||||
|
|
||||||
return MailAttachmentWithEInvoice(part.fileName, mediaType, invoice, file)
|
return MailAttachmentWithEInvoice(part.fileName, mediaType, invoice, file)
|
||||||
|
|
Loading…
Reference in New Issue