djdembeck/bragibooks

500 when specifying a directory with a single file

lovek323 opened this issue · 2 comments

I'm getting a 500 server error when I attempt to process a directory containing a single mp3 or m4b file:

Internal Server Error: /import/match
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 101, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/app/web/importer/views.py", line 125, in post
    input_data = helpers.get_directory(
  File "/usr/local/lib/python3.9/site-packages/m4b_merge/helpers.py", line 81, in get_directory
    num_of_files = find_num_of_files(path_to_use, return_find_ext)
  File "/usr/local/lib/python3.9/site-packages/m4b_merge/helpers.py", line 27, in find_num_of_files
    list_of_files = os.listdir(Path(path_to_check))
NotADirectoryError: [Errno 20] Not a directory: '/input/<filename>.mp3'

Sorry, I missed this!

What are you passing to Docker for your folders? It should be -v /path/to/input:/input

Likely closed with m4b-merge updates