gramps-web-api
gramps-web-api copied to clipboard
Single Tree setup with MEDIA_PREFIX_TREE=true does not create media directory
Environment:
- Existing Gramps tree on Windows Desktop
- New installation of GrampsWeb in docker stack,
- no tree imported
- MEDIA_PREFIX_TREE=true
- Existing family tree (no media files) synced from Desktop to Web
Steps to reproduce:
- Gramps Web -> Media List -> New Media Object -> Select photo -> Add
Expected:
- Media file is added
Actual:
- "Error: NOT FOUND" is displayed in the bottom left
Logs:
[2024-05-01 13:30:24 +0000] [15] [ERROR] Error handling request /api/media/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/gunicorn/workers/sync.py", line 135, in handle
self.handle_request(listener, req, client, addr)
File "/usr/local/lib/python3.11/dist-packages/gunicorn/workers/sync.py", line 178, in handle_request
respiter = self.wsgi(environ, resp.start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1488, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1466, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/auth.py", line 44, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/views.py", line 191, in dispatch_request
return current_app.ensure_sync(meth)(**kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/resources/media.py", line 83, in post
check_quota_media(to_add=size)
File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/media.py", line 371, in check_quota_media
update_usage_media(tree=tree)
File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/media.py", line 360, in update_usage_media
usage_media = media_handler.get_media_size(db_handle=db_handle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/media.py", line 151, in get_media_size
raise ValueError(f"Directory {self.base_dir} does not exist")
ValueError: Directory /app/media/dfb22cac-3453-433c-b7a9-b75aecd90c1e does not exist
When I manually create the folder in the filesystem, everything works as expected.