Refactor duplicate pdf mime-type validations