added conditional check on file content-type extraction