Skip to content

Commit

Permalink
Merge pull request #259 from scanon/issue258
Browse files Browse the repository at this point in the history
Fix for invalid json error due to different header
  • Loading branch information
dmjacobsen authored Aug 6, 2019
2 parents 69843f6 + 4a0f252 commit 5186aac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion imagegw/shifter_imagegw/dockerv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,10 @@ def do_token_auth(self, auth_loc_str, creds=False):

if resp.status != 200:
raise ValueError('Bad response getting token: %d', resp.status)
if resp.getheader('content-type') != 'application/json':
# The json content type can include a extra bit defining the character set
# so we just check the beginning. Worst case is the json.loads will throw
# an error just after this.
if not resp.getheader('content-type').startswith('application/json'):
raise ValueError('Invalid response getting token, not json')

auth_resp = json.loads(resp.read())
Expand Down
2 changes: 1 addition & 1 deletion imagegw/shifter_imagegw/imageworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def pull(request, updater, testmode=0):
try:
# Step 1 - Do the pull
updater.update_status('PULLING', 'PULLING')
logging.info(request)
logging.debug(request)
if not pull_image(request, updater=updater):
logging.info("Worker: Pull failed")
raise OSError('Pull failed')
Expand Down

0 comments on commit 5186aac

Please sign in to comment.