OCA / storage

GNU Affero General Public License v3.0
66 stars 148 forks source link

Documents app preview issue #313

Open JacooRe opened 6 months ago

JacooRe commented 6 months ago

Module

fs_attachment / fs_storage

Describe the bug

When using s3 storage for all attachments - unable to preview file (pdf, jpg, gif .... ) in Documents app image

workaround

if I upload an attachment (pdf) to TASK - I can preview it inside the task but if I try to preview the PDF via Documents app, throws error like on screenshot copy from docker container error:

2023-12-13 17:20:25,651 15 ERROR odoo odoo.http: Exception during request handling. 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1988, in __call__
    response = request._serve_db()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1611, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1724, in dispatch
    return self.request.registry['ir.http']._dispatch(endpoint)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 699, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/binary.py", line 75, in content_common
    stream = request.env['ir.binary']._get_stream_from(record, field, filename, filename_field, mimetype)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_binary.py", line 129, in _get_stream_from
    stream = self._record_to_stream(record, field_name)
  File "/mnt/extra-addons/documents/models/ir_binary.py", line 11, in _record_to_stream
    return Stream.from_attachment(record.attachment_id.sudo())
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 475, in from_attachment
    stat = os.stat(self.path)
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/odoo/filestore/odoo/abcd123a1:/so2023_3360347-2-31088-0.pdf'

For some reason, the Documents preview is looking into some local folder (which doesnt exist)

To Reproduce

Affected versions: odoo 16 fs_attachment+fs_storage latest documents app

Steps to reproduce the behavior:

  1. setup s3 for all attachments
  2. upload file (eg. pdf) to Documents app
  3. try to open the file in Documents app

Expected behavior Open/preview the file (pdf, jpg...whatever)

github-actions[bot] commented 3 weeks ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.