Exception thrown for brand links with non-alphabetic characters
Disclaimers
- [x] Before filing this report, I have read the documentation fully and followed it.
- [x] I understand that if the "issue" is something that is already answered by the documentation and/or are caused by me not reading the documentation, the issue will be blocked and/or locked (with the implicit explanation being to "go read the docs"), and I may not be able to open another issue for this repository ever again.
Issue Description
Describe the bug This appears to be nearly the same as Issue #797.
When following a brand link that contains non-alphabetic characters, an exception is thrown from the hashid module via objection-hashid:
The provided ID (link-test) is invalid, as it contains characters that do not exist in the alphabet (Vm6yhUHCuItcsFTfSi87zkMo0EPZra5nAXdvRgj9BGw1WeD3xJOqlpQLNK42bY)
Brand links that do not trigger this validation work as expected, as do the generated short link.
Deployment Method Production:
- AWS ECS Fargate (behind Application Load Balancer) + AWS RDS (PostgreSQL 16.3) + AWS ElastiCache (Redis 6.2.6)
Local testing:
- Docker container from deploy/docker-compose/docker-compose.yml
To Reproduce
- Create a link with the "Brand Link" field set to any value containing at least one non-alphanumeric character (e.g. "test-link")
- In the links index, click the URL in the "Brand Link" column:
- Browser will show the exact message described above
- In the links index, click the URL in the "Short Link" column
- Browser will redirect to URL displayed in the "Original link" column
Expected behavior Requests for any "brand link" should redirect the same as the corresponding "short link"
Screenshots N/A
Additional context I haven't taken the time to fully understand the relationship between the "link" model and the "objection-hashid" module, but it seems that the slug of the brand link is being treated as a hashed ID of the short link; like, the request handler can't tell the difference between a hashed ID and a brand slug. So when "hashids" tries to decode that back into a row ID, it Blows the F∙ck Up™.
~It's odd that no one else has reported this already, though, given it's apparent popularity.~ Plus, screenshots in the documentation show some brand links with underscores, so I'm not sure why this is different for me.