Corrected the order of string prefix 'r' and 'b' under python2.
- Legacy-Id: 16445
This commit is contained in:
parent
19afa444f8
commit
6ace81b25d
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue