collective / wildcard.media

13 stars 12 forks source link

StreamView is broken #75

Closed 1letter closed 1 year ago

1letter commented 3 years ago

I get a traceback if the Video Source should be played.

Traceback (most recent call last):
  File "/Development/Plone/SOSNET/eggs/waitress-1.4.4-py3.8.egg/waitress/channel.py", line 350, in service
    task.service()
  File "/Development/Plone/SOSNET/eggs/waitress-1.4.4-py3.8.egg/waitress/task.py", line 171, in service
    self.execute()
  File "/Development/Plone/SOSNET/eggs/waitress-1.4.4-py3.8.egg/waitress/task.py", line 441, in execute
    app_iter = self.channel.server.application(environ, start_response)
  File "/Development/Plone/SOSNET/eggs/Paste-3.4.1-py3.8.egg/paste/translogger.py", line 69, in __call__
    return self.application(environ, replacement_start_response)
  File "/Development/Plone/SOSNET/eggs/Zope-4.5-py3.8.egg/ZPublisher/httpexceptions.py", line 30, in __call__
    return self.application(environ, start_response)
  File "/Development/Plone/SOSNET/eggs/Zope-4.5-py3.8.egg/ZPublisher/WSGIPublisher.py", line 377, in publish_module
    status, headers = response.finalize()
  File "/Development/Plone/SOSNET/eggs/Zope-4.5-py3.8.egg/ZPublisher/HTTPResponse.py", line 1056, in finalize
    self.setHeader('content-length', len(self.body))
TypeError: object of type 'filestream_range_iterator' has no len()

But the interface IStreamIterator required a method len () per definition. It's not implemented in the filestream_range_iterator.

Versions: plone.namedfile 5.4.0 wildcard.media 2.1.0 Plone 5.2.2 py3

ale-rt commented 3 years ago

I recently added this https://github.com/plone/plone.dexterity/pull/139 to plone.dexterity. What happens if you pin plone.dexterity 2.10.0?

1letter commented 3 years ago

That doesn't help. I pinned the version to 2.10.0 and run the buildout. But the error don't go away.

ale-rt commented 3 years ago

You are right, I did not notice it was another adapter: https://github.com/plone/plone.namedfile/blob/14c1a3539cee99c3983adeb28eca5117272b7591/plone/namedfile/utils/__init__.py#L74-L75 Anyway the fix should be similar to https://github.com/plone/plone.dexterity/pull/139

1letter commented 3 years ago

i will check it. thanks for hint

1letter commented 3 years ago

i think it's a incorrect interface @ale-rt , see here my comment

mamico commented 2 years ago

filestream_range_iterator is a pseudo stream implementation, you need to have all the file available, but you can expose parts of them using HTTP Range headers. I was wondering why a similar issue was not reported in plone.namedilfe, so I double-checked and found differences between here and plone.namedfile. @1letter please check if #78 solves the issue.