A customer of ours was attempting to PUT files in a tempurl, which is supposed to be legl legal according to "/info".
However, the PUT failed with this backtrace:
Traceback (most recent call last):
File "eventlet/wsgi.py", line 573, in handle_one_response
result = self.application(self.environ, start_response)
File "swift/common/middleware/catch_errors.py", line 145, in __call__
return context.handle_request(env, start_response)
File "swift/common/middleware/catch_errors.py", line 120, in handle_request
self._response_headers.append(('X-Trans-Id', trans_id))
AttributeError: 'dict_items' object has no attribute 'append'
The immediate cause is this:
- Append is attempted on something that is not a list
A customer of ours was attempting to PUT files in a tempurl, which is supposed to be legl legal according to "/info".
However, the PUT failed with this backtrace:
Traceback (most recent call last): n(self. environ, start_response) common/ middleware/ catch_errors. py", line 145, in __call__ handle_ request( env, start_response) common/ middleware/ catch_errors. py", line 120, in handle_request _response_ headers. append( ('X-Trans- Id', trans_id))
File "eventlet/wsgi.py", line 573, in handle_one_response
result = self.applicatio
File "swift/
return context.
File "swift/
self.
AttributeError: 'dict_items' object has no attribute 'append'
The immediate cause is this:
- Append is attempted on something that is not a list
self. _response_ headers = somedict.items() _response_ headers. append( ('X-Trans- Id', trans_id))
...
self.
That is not legal in python3 (it was in python2).
I checked for .items() candidates, and there are few. At least:
swift/ common/ middleware/ symlink. py: _response_ headers = response_ header_ dict.items( )
self.
swift/ common/ middleware/ tempurl. py:
return headers.items()
And the latter makes the most sense, as the user was using the tempurl functionality.
And indeed, this patch fixes things: middleware/ tempurl. py middleware/ tempurl. py
if h.startswith(p):
del headers[h]
break items() )
```
--- swift/common/
+++ swift/common/
@@ -839,7 +839,7 @@ class TempURL(object):
- return headers.items()
+ return list(headers.
def filter_ factory( global_ conf, **local_conf):
```
Versions:
- swift 2.25.1, but according to git, nothing was changed between 2.25.1 and master
- python3.8, but that's irrelevant
Cheers,
Walter Doekes
OSSO B.V.