Skip to content

Commit 169ed96

Browse files
authored
Merge pull request #2465 from phw/PICARD-2895
PICARD-2895: Web service requests must set Authorization header only when required
2 parents 3970a61 + c9c980e commit 169ed96

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

picard/webservice/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Copyright (C) 2007 Lukáš Lalinský
66
# Copyright (C) 2009 Carlin Mangar
77
# Copyright (C) 2017 Sambhav Kothari
8-
# Copyright (C) 2018-2022 Philipp Wolfer
8+
# Copyright (C) 2018-2022, 2024 Philipp Wolfer
99
# Copyright (C) 2018-2023 Laurent Monin
1010
# Copyright (C) 2021 Tche333
1111
#
@@ -220,8 +220,9 @@ def has_auth(self):
220220
return self.mblogin and self.access_token
221221

222222
def _update_authorization_header(self):
223-
auth = 'Bearer ' + self.access_token if self.has_auth else ''
224-
self.setRawHeader(b'Authorization', auth.encode('utf-8'))
223+
if self.has_auth:
224+
auth = 'Bearer ' + self.access_token
225+
self.setRawHeader(b'Authorization', auth.encode('utf-8'))
225226

226227
@property
227228
def host(self):

0 commit comments

Comments
 (0)