Skip to content

Commit

Permalink
Merge pull request #9194 from nextcloud/backport/9189/stable26
Browse files Browse the repository at this point in the history
[stable26] Add missing user agent and double slashes cleanup
  • Loading branch information
nickvergessen authored Mar 28, 2023
2 parents 17643f1 + 8a67074 commit cdd8cd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions recording/src/nextcloud/talk/recording/BackendNotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def backendRequest(backend, data):
'OCS-ApiRequest': 'true',
'Talk-Recording-Random': random,
'Talk-Recording-Checksum': checksum,
'User-Agent': 'Mozilla/5.0 (Recording) Nextcloud-Talk v' + recording.__version__,
'User-Agent': recording.USER_AGENT,
}

backendRequest = Request(url, data, headers)
Expand Down Expand Up @@ -187,7 +187,7 @@ def uploadRecording(backend, token, fileName, owner):

logger.info(f"Upload recording {fileName} to {backend} in {token} as {owner}")

url = backend + '/ocs/v2.php/apps/spreed/api/v1/recording/' + token + '/store'
url = backend.rstrip('/') + '/ocs/v2.php/apps/spreed/api/v1/recording/' + token + '/store'

fileContents = None
with open(fileName, 'rb') as file:
Expand All @@ -208,6 +208,7 @@ def uploadRecording(backend, token, fileName, owner):
'OCS-ApiRequest': 'true',
'Talk-Recording-Random': random,
'Talk-Recording-Checksum': checksum,
'User-Agent': recording.USER_AGENT,
}

uploadRequest = Request(url, data, headers)
Expand Down
3 changes: 3 additions & 0 deletions recording/src/nextcloud/talk/recording/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# @copyright Copyright (c) 2023, Daniel Calviño Sánchez ([email protected])
# @copyright Copyright (c) 2023, Elmer Miroslav Mosher Golovin ([email protected])
#
# @license GNU AGPL version 3 or any later version
#
Expand All @@ -21,3 +22,5 @@

RECORDING_STATUS_AUDIO_AND_VIDEO = 1
RECORDING_STATUS_AUDIO_ONLY = 2

USER_AGENT = f'Mozilla/5.0 (Recording) Nextcloud-Talk v{__version__}'

0 comments on commit cdd8cd8

Please sign in to comment.