Skip to content

Commit c212095

Browse files
committed
Handle lower case http location header name for backup/restore
1 parent dbd6660 commit c212095

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/python/opal/backup_project.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ def do_command(args):
4444
response = request.post().resource(uri).content(json.dumps(options)).send()
4545

4646
# get job status
47-
job_resource = re.sub(r'http.*\/ws', r'', response.headers['Location'])
47+
location = None
48+
if 'Location' in response.headers:
49+
location = response.headers['Location']
50+
elif 'location' in response.headers:
51+
location = response.headers['location']
52+
job_resource = re.sub(r'http.*\/ws', r'', location)
4853
request = client.new_request()
4954
request.fail_on_error().accept_json()
5055
if args.verbose:

src/main/python/opal/restore_project.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ def do_command(args):
4545
response = request.post().resource(uri).content(json.dumps(options)).send()
4646

4747
# get job status
48-
job_resource = re.sub(r'http.*\/ws', r'', response.headers['Location'])
48+
location = None
49+
if 'Location' in response.headers:
50+
location = response.headers['Location']
51+
elif 'location' in response.headers:
52+
location = response.headers['location']
53+
job_resource = re.sub(r'http.*\/ws', r'', location)
4954
request = client.new_request()
5055
request.fail_on_error().accept_json()
5156
if args.verbose:

0 commit comments

Comments
 (0)