in #45 I have raised a PR to add the Content-Type header in order to allow downloads on mobile safari iOS. Unfortunately, setting the header had been removed in commit e52f6589bf5722f72147a943cd2931e1c393b544 in this line for issue #49. I assume it was tested on macOS desktop Safari. The behaviour is different between mobile and desktop Safari. If Content-Type header is missing, mobile Safari will not honor file extension and instead adds a .html to the download filename making it impossible to download a e.g. PDF. In contrast, if header is missing on desktop Safari, the browser guesses mime type by file extension.
Please re-add the header again to enable downloads on mobile safari:
Note: The @FunctionInterface ContentTypeGenerator still exists in the code, but the method getContentType is never called. This was hard to find, as my program continued to set the withContentTypeGenerator but the lambda itself was not called anymore.
Hi @mstahv,
in #45 I have raised a PR to add the
Content-Type
header in order to allow downloads on mobile safari iOS. Unfortunately, setting the header had been removed in commit e52f6589bf5722f72147a943cd2931e1c393b544 in this line for issue #49. I assume it was tested on macOS desktop Safari. The behaviour is different between mobile and desktop Safari. IfContent-Type
header is missing, mobile Safari will not honor file extension and instead adds a.html
to the download filename making it impossible to download a e.g. PDF. In contrast, if header is missing on desktop Safari, the browser guesses mime type by file extension.Please re-add the header again to enable downloads on mobile safari:
response.setHeader("Content-Type", contentTypeGenerator.getContentType());
Note: The
@FunctionInterface ContentTypeGenerator
still exists in the code, but the methodgetContentType
is never called. This was hard to find, as my program continued to set thewithContentTypeGenerator
but the lambda itself was not called anymore.Please see attached PR.
Thanks, Timo