fix(svn): fixed txn_id extraction from the data buffer.

- This buffer is always BYTES
- use new python3 getvalue that can get the data and not exhaust the iterator
- fixes # 5707
This commit is contained in:
RhodeCode Admin 2023-11-23 10:19:44 +01:00
parent 8a480af3c1
commit 4162cecdee

View file

@ -599,13 +599,13 @@ class SimpleVCS(object):
also handles the locking exceptions which will be triggered when
the first chunk is produced by the underlying WSGI application.
"""
txn_id = ''
if 'CONTENT_LENGTH' in environ and environ['REQUEST_METHOD'] == 'MERGE':
# case for SVN, we want to re-use the callback daemon port
# so we use the txn_id, for this we peek the body, and still save
# it as wsgi.input
data = environ['wsgi.input'].read()
environ['wsgi.input'] = io.StringIO(data)
data: str = safe_str(environ['wsgi.input'].getvalue())
txn_id = extract_svn_txn_id(self.acl_repo_name, data)
callback_daemon, extras = self._prepare_callback_daemon(