Guess a file attachment's content type if application/octet-stream.

If a browser claims a file's content type is application/octet-stream,
get a second opinion by asking `file --mime-type`. This helps with some
browsers or server setups where that useless mimetype is being used,
preventing some files from being reviewable.

Fixes bug #2269
Reviewed at https://reviews.reviewboard.org/r/6016/
Don't trust the browser-provided mimetype if it looks bogus.

A user was reporting that their PDF file uploads were being assigned the
mimetype of "text/text/application/pdf", which is completely bogus. If
splitting on '/' produces anything other than a list of two strings, don't
allow it to proceed.

Testing done: Ran unit tests.

Fixes bug 3427.

Reviewed at https://reviews.reviewboard.org/r/6118/