Skip to content

Fix potential KeyError in raise_dropbox_error_for_resp and replace eval()#527

Open
neuralbroker wants to merge 1 commit into
dropbox:mainfrom
neuralbroker:fix/keyerror-and-eval
Open

Fix potential KeyError in raise_dropbox_error_for_resp and replace eval()#527
neuralbroker wants to merge 1 commit into
dropbox:mainfrom
neuralbroker:fix/keyerror-and-eval

Conversation

@neuralbroker

Copy link
Copy Markdown

1. Fix potential KeyError in raise_dropbox_error_for_resp()

If the server returns a 400 with valid JSON that doesn't contain the 'error' key, accessing
es.json()['error'] raises an unhandled KeyError. Changed to use .get('error') to safely access the key.

Also widened the except clause to catch AttributeError alongside ValueError.

2. Replace eval() with safe string parsing

Using eval() to parse a version string from a file is unnecessary and fragile. Replaced with simple string stripping.

…al() in setup.py

1. Fix potential KeyError in raise_dropbox_error_for_resp() - use .get('error') instead of ['error'] to avoid KeyError when JSON doesn't contain the error key. Also catch AttributeError alongside ValueError.
2. Replace eval() with safe string parsing in setup.py
@CLAassistant

CLAassistant commented Jun 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants