Fix several bugs with handling e-mail files

- When converting from html->pdf, the wkhtmltopdf program exits with
  errors if the document contains invalid links. The content is now
  cleaned before handed to wkhtmltopdf.
- Update emil library which fixes a bug when reading mails without
  explicit transfer encoding (8bit)
- Add a info header to converted mails
This commit is contained in:
Eike Kettner
2020-04-07 22:05:24 +02:00
parent 12672938a0
commit 1206105f0b
9 changed files with 115 additions and 52 deletions

View File

@ -1,5 +1,6 @@
package docspell.common
import cats.effect._
import fs2.{Chunk, Pipe, Stream}
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets
@ -42,6 +43,9 @@ object Binary {
util.decode[F](cs)
}
def loadAllBytes[F[_]: Sync](data: Stream[F, Byte]): F[ByteVector] =
data.chunks.map(_.toByteVector).compile.fold(ByteVector.empty)((r, e) => r ++ e)
// This is a copy from org.http4s.util
// Http4s is licensed under the Apache License 2.0
private object util {
@ -85,5 +89,6 @@ object Binary {
if (chunk.size >= 3 && chunk.take(3) == utf8Bom) {
chunk.drop(3)
} else chunk
}
}