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

Exception thrown for brand links with non-alphabetic characters #814

Open
2 tasks done
MaffooClock opened this issue Jul 25, 2024 · 0 comments
Open
2 tasks done

Exception thrown for brand links with non-alphabetic characters #814

MaffooClock opened this issue Jul 25, 2024 · 0 comments

Comments

@MaffooClock
Copy link

MaffooClock commented Jul 25, 2024

Disclaimers

  • Before filing this report, I have read the documentation fully and followed it.
  • 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:

To Reproduce

  1. Create a link with the "Brand Link" field set to any value containing at least one non-alphanumeric character (e.g. "test-link")
  2. In the links index, click the URL in the "Brand Link" column:
    • Browser will show the exact message described above
  3. 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.

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

No branches or pull requests

1 participant