Files.probeContentType() was inconsistent across different Operating systems. Apache Tika seems to be more consistent and does not have the issue of failing for classpath: resources on Windows.
I also changed the default return type for unknown file types to application/octet-stream. This seems to be what Apache Tika recommends as a default MIME type and it seems fair. If you want plain/text, send a .txt file, otherwise interpret it as a binary stream.
Related issues: https://github.com/bastion-dev/Bastion/issues/63 https://github.com/bastion-dev/Bastion/issues/77
Files.probeContentType() was inconsistent across different Operating systems. Apache Tika seems to be more consistent and does not have the issue of failing for
classpath:
resources on Windows.I also changed the default return type for unknown file types to
application/octet-stream
. This seems to be what Apache Tika recommends as a default MIME type and it seems fair. If you wantplain/text
, send a .txt file, otherwise interpret it as a binary stream.