[tahoe-lafs-trac-stream] [Tahoe-LAFS] #3854: builtins.TypeError: write() argument must be str, not bytes from allmydata/webish.py usage of FileUploadFieldStorage

Tahoe-LAFS trac at tahoe-lafs.org
Thu Jan 6 13:53:05 UTC 2022


#3854: builtins.TypeError: write() argument must be str, not bytes from
allmydata/webish.py usage of FileUploadFieldStorage
-------------------------+-----------------------
     Reporter:  exarkun  |      Owner:  itamarst
         Type:  defect   |     Status:  new
     Priority:  normal   |  Milestone:  undecided
    Component:  unknown  |    Version:  n/a
   Resolution:           |   Keywords:
Launchpad Bug:           |
-------------------------+-----------------------

Comment (by exarkun):

 The request that triggers the traceback is a POST to `/storage-plugins
 /privatestorageio-zkapauthz-v1/calculate-price` (so, not a first-part
 resource).

 The headers are:

 {{{
 { 'content-length': '2433'
 , 'authorization': 'tahoe-lafs O_0Cs...'
 , 'content-type': 'application/json'
 , 'accept-encoding': 'gzip'
 , 'host': '127.0.0.1:39053'
 }
 }}}

 There are some first-party resources that accept JSON so maybe it is
 possible to reproduce this without involving third-party plugins.
 Although I don't know what it means that there are not already any failing
 unit tests for this code path (apart from the obvious guess of incomplete
 test coverage).

 Looking at docs/frontends/webapi.rst I see `POST /uri?t=mkdir-with-
 children` which should be pretty similar (there are also a lot of
 variations on that action, "create a directory", that also take JSON
 bodies).

 The docs *don't* say that a `content-type: application/json` header is
 required in these cases.  I don't know if that's a relevant distinction or
 not.

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3854#comment:6>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list