这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@puck
Copy link
Contributor

@puck puck commented Apr 20, 2013

When trying to create a new channel using PostgreSQL as a database I was getting a database error that api_key's value was too long for type character varying(16).

Looking into the code I found that generate_api_key has an instance of 0..size which iterates through size + 1 elements. So asking for an API Key that was 16 characters long was actually returning a string of 17 characters. This broke trying to shove it into a varchar(16) in PostgreSQL.

This patch ensures that only size characters are returned.

0..size iterates through size + 1 elements. So asking for an API
that was 16 was actually returning a string of 17 characters. This
broke trying to shove it into a varchar(16) in PostgreSQL.
iobridge added a commit that referenced this pull request Apr 21, 2013
PostgreSQL: Fix returning an API Key that was size + 1
@iobridge iobridge merged commit 94e937e into iobridge:master Apr 21, 2013
@puck puck deleted the fix-api-generation branch April 21, 2013 20:54
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