Skip to content
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

Prevent blank database names #843

Closed
wants to merge 1 commit into from
Closed

Prevent blank database names #843

wants to merge 1 commit into from

Conversation

otoolep
Copy link
Contributor

@otoolep otoolep commented Aug 18, 2014

Prevent issue #812 from re-occurring.

@@ -637,6 +637,16 @@ func (self *ApiSuite) TestCreateDatabase(c *C) {
c.Assert(self.coordinator.db, Equals, "foo")
}

func (self *ApiSuite) TestCreateDatabaseFailures(c *C) {
data := []string{`{"name": ""}`, `{}`, `{"not_name": "bar"}`}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While in here I decided to test some other bad requests.

@otoolep
Copy link
Contributor Author

otoolep commented Aug 19, 2014

I pushed up a simple change to the patch, so a helpful message is returned to the user. A more comprehensive fix for this issue would be if you guys specified what is acceptable as a database name, and then I encode the spec as a regex check. [0-9a-zA-Z_-] could work, but perhaps you'd like to support a broader range of names. The same fundamental issue applies to usernames, passwords etc., I am guessing.

That said, this change prevents basic mistakes during database creation.

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.

None yet

3 participants