Corrected the order of string prefix 'r' and 'b' under python2.

- Legacy-Id: 16445
This commit is contained in:
Henrik Levkowetz 2019-07-15 15:37:48 +00:00
parent 19afa444f8
commit 6ace81b25d

View file

@ -1,7 +1,9 @@
# -*- python -*-
# Copyright The IETF Trust 2016-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import re
import magic
@ -77,7 +79,7 @@ def validate_mime_type(file, valid):
mime_type, encoding = get_mime_type(raw)
# work around mis-identification of text where a line has 'virtual' as
# the first word:
if mime_type == 'text/x-c++' and re.search(rb'(?m)^virtual\s', raw):
if mime_type == 'text/x-c++' and re.search(br'(?m)^virtual\s', raw):
mod = raw.replace(b'virtual', b' virtual')
mime_type, encoding = get_mime_type(mod)
if valid and not mime_type in valid: