Commit b819f8da authored by Jérome Perrin's avatar Jérome Perrin

core: fix Flags not at the start of the expression warnings with new mimetypes_registry

This is follow up of commit 0000dee0 (erp5_core: update
mimetypes_registry with shared-mime-info_2.4-5 and media-types_10.1.0.,
2024-09-17), after this change, Products.MimetypesRegistry build regular
expressions with fnmatch.translate, which on python2 produces regular
expressions like:

     >>> fnmatch.translate('*.aaa')
     '.*\\.aaa\\Z(?ms)

such expressions cause a warning in python3:

    >>> re.compile('.*\\.aaa\\Z(?ms)')
    ...
    re.error: global flags not at the start of the expression at position 9

Running this on python3 would be incompatible with python2, because
`fnmatch.translate` on python3 generates regular expressions that are not
valid on python2.

To solve this mimetypes_registry.xml was edited by hand to move the
flags at the beginning, replacing for example '.*\\.aaa\\Z(?ms)' by
'(?ms).*\\.aaa\\Z'
parent f02d7675
Pipeline #37053 failed with stage
in 0 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment