• Arnaud Fontaine's avatar
    zope5: Since Zope 5.8.1 CONTENT_TYPE HTTP header must be specified for PUT request. · 636de5ba
    Arnaud Fontaine authored
    Despite RFC 4918 stating that Content-Type *SHOULD* be provided, since the
    following commit no CONTENT_TYPE means application/x-www-form-urlencoded thus
    processing the request as a form and not a binary file (with cgi.FieldStorage,
    it was text/plain and all the form-processing logic was skipped):
      commit 5b324f6c461f5ea1cc069739b6c32a1a5ff59df9
      Date:   Thu Jan 19 07:15:18 2023 +0100
        replace `cgi.FieldStorage` by `multipart` (#1094)
        * interpret a missing `CONTENT_TYPE` as `application/x-www-form-urlencoded`
    
    This raises the following exception:
      Traceback (most recent call last):
        File "erp5://portal_components/test.erp5.testWebDavSupport", line 232, in test_PROPFIND_on_document
          response = self.publish(
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/erp5/product/ERP5Type/tests/ERP5TypeTestCase.py", line 793, in publish
          return super(ERP5TypeTestCaseMixin, self).publish(
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/Testing/ZopeTestCase/functional.py", line 42, in wrapped_func
          return func(*args, **kw)
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/Testing/ZopeTestCase/functional.py", line 133, in publish
          wsgi_result = publish(env, start_response)
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/httpexceptions.py", line 30, in __call__
          return self.application(environ, start_response)
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/WSGIPublisher.py", line 391, in publish_module
          response = _publish(request, new_mod_info)
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/erp5/product/ERP5Type/patches/WSGIPublisher.py", line 150, in publish
          return _original_publish(request, module_info)
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/WSGIPublisher.py", line 251, in publish
          request.processInputs()
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/erp5/product/Localizer/patches.py", line 37, in new_processInputs
          HTTPRequest.old_processInputs(self)
        File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/Zope-5.10-py3.9.egg/ZPublisher/HTTPRequest.py", line 544, in processInputs
          key = item.name.encode("latin-1").decode(
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 10: invalid continuation byte
    636de5ba
test.erp5.testWebDavSupport.py 12.4 KB