Skip to content

Conversation

@bojidar-danchev
Copy link

I've added a simple update to parse a boolean from the reuse input when creating links. It was always a truthy value when using the API with x-www-form-urlencoded input unless you leave it out or send an empty string which caused unexpected behavior.
I also noticed that new links were always added to the Redis cache as 'undefined--{user_id}' in the v1 API resulting in calls with 'reuse': true to return the first link added to cache (which often has a different target), so I added generation of a new key when adding a link to cache. It looks like that has already been done in the v2 API.

…rings; Added generation of a new key when adding a link to Redis to avoid returning links for the wrong target;

export const getBoolean = (input: any): boolean => {
switch(String(input).toLowerCase()) {
case "false": case "no": case "0": case "": return false;
Copy link
Member

Choose a reason for hiding this comment

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

undefined and null are not handled

@poeti8 poeti8 closed this Dec 14, 2020
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