Brackets in directory name cause "bad character range" error
Steps to reproduce
- Run the command-line importer (
docker exec -it funkwhale manage import_files "c84a3597-3fb3-4a78-af08-6ba4688d770d" "/music/**/*.mp3" --recursive --noinput --in-place
)
What happens?
Traceback (most recent call last):
File "manage.py", line 20, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/app/api/funkwhale_api/music/management/commands/import_files.py", line 139, in handle
matching += glob.glob(import_path, **glob_kwargs)
File "/usr/lib/python3.6/glob.py", line 20, in glob
return list(iglob(pathname, recursive=recursive))
File "/usr/lib/python3.6/glob.py", line 71, in _iglob
for dirname in dirs:
File "/usr/lib/python3.6/glob.py", line 72, in _iglob
for name in glob_in_dir(dirname, basename, dironly):
File "/usr/lib/python3.6/glob.py", line 83, in _glob1
return fnmatch.filter(names, pattern)
File "/usr/lib/python3.6/fnmatch.py", line 52, in filter
match = _compile_pattern(pat)
File "/usr/lib/python3.6/fnmatch.py", line 46, in _compile_pattern
return re.compile(res).match
File "/usr/lib/python3.6/re.py", line 233, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.6/re.py", line 301, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.6/sre_compile.py", line 562, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.6/sre_parse.py", line 855, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.6/sre_parse.py", line 416, in _parse_sub
not nested and not items))
File "/usr/lib/python3.6/sre_parse.py", line 765, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/usr/lib/python3.6/sre_parse.py", line 416, in _parse_sub
not nested and not items))
File "/usr/lib/python3.6/sre_parse.py", line 553, in _parse
raise source.error(msg, len(this) + 1 + len(that))
sre_constants.error: bad character range o-C at position 56
What is expected?
Audio files should be imported without that error
Context
Funkwhale version(s) affected: 0.18.1
In discussing with Eliot in the Matrix room, it appears there was one directory causing this issue:
Isao Tomita - Grand Canyon Suite [New Age, Neo-Classical 1982]
Renaming this to a title without brackets ([ ]
) seems to have solved it