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

Alphabet must contain at least 16 unique characters #44

Closed
wowkin2 opened this issue Jun 5, 2020 · 2 comments
Closed

Alphabet must contain at least 16 unique characters #44

wowkin2 opened this issue Jun 5, 2020 · 2 comments

Comments

@wowkin2
Copy link

wowkin2 commented Jun 5, 2020

In fresh version 3.1.2 something was changed and crashes usage of Django url reversion ({% url 'blog_post' post_id=post.id %}). Version 3.1.1 works fine.
I have custom alphabet for HashidAutoField:
id = HashidAutoField(primary_key=True, alphabet=HASHID_ALPHABET, min_length=HASHID_MIN_LENGTH)

@nshafer
Copy link
Owner

nshafer commented Jun 5, 2020

This is nothing new, and it's a requirement of the Hashids library and the algorithm. If you're not providing 16 unique charactes, then I have no idea how it was working before. The only thing that's different is that in 3.1.2 an instance of the Hashids library is created on startup, whereas before it was created on-the-fly. But there was a check for the length, so did you have checks disabled or something? What is the value of HASHID_ALPHABET?

@nshafer
Copy link
Owner

nshafer commented Jun 5, 2020

I just published 3.1.3 that properly checks that the given alphabet has at least 16 unique characters... it was only checking overall length and would let through 16 duplicates. I would still like to know what your HASHID_ALPHABET is set to.

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

No branches or pull requests

2 participants