inveniosoftware / invenio-app-rdm

Turn-key research data management platform.
https://inveniordm.docs.cern.ch
MIT License
100 stars 144 forks source link

Filenames with apostrophe break preview #1966

Open fenekku opened 1 year ago

fenekku commented 1 year ago

Package version (if known): v9.1+

Describe the bug

Filenames with apostrophes can't be previewed correctly.

Steps to Reproduce

  1. Upload a record with an apostrophe in its accompanying filename
  2. See the broken previewer on the landing page

Expected behavior

The file is previewed correctly.

Screenshots (if applicable)

image

Additional context

Notice how the quote messes with the file fetching

127.0.0.1 - - [14/Nov/2022 14:27:31] "GET /records/mme34-m2c18/files/The%20early%20diagnosis%20of%20disease%20of%20the%20kidneys,%20especially%20Bright& HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/path/to/.venv/lib/python3.7/site-packages/flask/app.py", line 2091, in __call__
    return self.wsgi_app(environ, start_response)
  File "/path/to/.venv/lib/python3.7/site-packages/werkzeug/middleware/proxy_fix.py", line 187, in __call__
    return self.app(environ, start_response)
  File "/path/to/.venv/lib/python3.7/site-packages/werkzeug/middleware/dispatcher.py", line 78, in __call__
    return app(environ, start_response)
  File "/path/to/.venv/lib/python3.7/site-packages/flask/app.py", line 2076, in wsgi_app
    response = self.handle_exception(e)
  File "/path/to/.venv/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/path/to/.venv/lib/python3.7/site-packages/flask/app.py", line 1519, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/path/to/.venv/lib/python3.7/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/path/to/.venv/lib/python3.7/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/path/to/.venv/lib/python3.7/site-packages/invenio-app-rdm/invenio_app_rdm/records_ui/views/decorators.py", line 79, in view
    return f(**kwargs)
  File "/path/to/.venv/lib/python3.7/site-packages/invenio-app-rdm/invenio_app_rdm/records_ui/views/decorators.py", line 159, in view
    return f(**kwargs)
  File "/path/to/.venv/lib/python3.7/site-packages/invenio-app-rdm/invenio_app_rdm/records_ui/views/records.py", line 165, in record_file_download
    return file_item.send_file(as_attachment=download)
AttributeError: 'NoneType' object has no attribute 'send_file'
github-actions[bot] commented 1 year ago

This issue was automatically marked as stale.

github-actions[bot] commented 1 year ago

This issue was automatically marked as stale.

github-actions[bot] commented 1 year ago

This issue was automatically marked as stale.