Revert "Remove Tika dependency for uploadvalidator"
This reverts commit be977bde860f755b7002019f561f6b16265aeab6.
With change [1], Tika was removed in favor of the default
MimeUtils2 library for detecting mime types. This leads
to a regression where plain ASCII files without a (known) file
extension are falsely identified as "application/octet-stream"
and therefore result in rejected changes.
This change fixes this by reintroducing Tika to restore
previous behavior. However, I'm not sure if this is the
right approach since the issue probably also could affect
Gerrit core which uses MimeUtils2. Since MimeUtils2 is
not under active maintenance, I'm not sure how feasible
a fix would be there.
The following three cases where identified:
cat << EOF > testfile
TEST
EOF
should be: text/plain
cat << EOF > testfile.csv
TEST
EOF
should be: text/csv
cat << EOF > testfile.y
TEST
EOF
should be: text/x-c or text/plain
[1] https://gerrit.googlesource.com/plugins/uploadvalidator/+/be977bde860f755b7002019f561f6b16265aeab6%5E%21/
Issue: 12706
Change-Id: I75d8b85d7be0e11dffeee410d4b3ed3c5dcfc08c
11 files changed