Search code examples
filepdfapache-nifimime-typesdoc

Nifi Processor not preserving file extension


I have a Nifi flow where a document file eg/pdf, doc etc is sent from a REST API to a Nifi ListenHTTP processor. The processor is configured to accept all headers. Here is my problem

Steps to reproduce:

  1. hello-world.pdf sent to ListenHttp processor
  2. inspect the queue and download the file

expected result: The downloaded file should be named 'hello-world.pdf'

actual result: The downloaded file is named 'hello-world'

However, if I use a HandleHttpRequest processor followed by a HandleHttpResponse processor I get the expected result.

Does anybody know why the ListenHttp processor does not give me the expected result?


Solution

  • The solution is to add an 'update attribute' processor with an attribute

    key mime.type value ${Content-Type}

    This is because the HttpListener processor does not write this header by default.