Skip to content

fix: validating undefined connection strings #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Aug 16, 2024

Conversation

hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented May 10, 2024

The extension obtains the connection string by getting the corresponding environment variable / App Setting. If the connection string variable name is not an app setting, the connection property is set to None. When creating a client type and the connection is None, the azure-storage-blob sdk throws an error saying: AttributeError("'NoneType' object has no attribute 'rstrip'").

This is not a clear error, so this adds validation on the connection string in the extension side. If the connection is None, an error will be thrown saying ValueError('Storage account connection string NAME does not exist. Please make sure that it is a defined App Setting.')

The purpose of this PR is not to perform validation on the connection string object. The sdk already does this. The goal of this is to improve the error in the specific case where the connection string is formatted correctly but does not have corresponding value set.

  • If the provided connection variable exists but its corresponding connection string value is invalid, the sdk will throw an error saying ValueError('Connection string missing required connection details.')
  • If the provided connection string is invalid (eg. contains invalid characters, empty, or whitespace), the sdk will throw an error saying ValueError: Connection string is either blank or malformed..

@hallvictoria hallvictoria marked this pull request as ready for review May 10, 2024 21:18
@hallvictoria hallvictoria merged commit 0bd61fb into dev Aug 16, 2024
29 checks passed
@hallvictoria hallvictoria deleted the hallvictoria/invalid-connection-string branch August 16, 2024 20:44
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.

3 participants