Make mimetype match scoring much stricter.

Review Request #10226 — Created Oct. 12, 2018 and submitted — Latest diff uploaded

david
Review Board
release-4.0.x
e8c7593...
reviewboard

When we initially created the mimetype matcher, it was okay to get some
false positives, because all it was used for was choosing an icon to
show for the file attachment. We now no longer have icons at all, but we
do have review UIs which behave completely incorrectly when there's a
bad file type. We recently added application/x-javascript to the
TextReviewUI, but this was matching all sorts of incorrect files, like
application/msdownload and application/x-pdf.

This change tightens up the scoring system a lot more, making it so that
if there aren't wildcards, both the type and subtype have to match
exactly. The addition of a vendor tag will cause the match to score
higher, but is not required.

Ran unit tests.

Loading...