YOURLS: Errors when 'Allow Hyphens in Short URLs' is disabled
Reproducible bug summary
- enable Allow Hyphens in Short URLs plugin
- create short URL containing hyphen(s)
e.g.
sho.rt/a-b
- deactivate plugin;
- hyphens not shown in Short URL column in
admin/index.php
i.e. sho.rt/ab
shown where sho.rt/a-b
used to be
- neither
sho.rt/a-b
nor sho.rt/ab
successfully redirect to target
- trying to delete the link results in the error
something wrong happened while deleting :/
Technical details
- YOURLS version: 1.7.2
- PHP version: 7.1.8
- Ubuntu 16.04.3 LTS w/ Apache 2.4.27
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (7 by maintainers)
An Evolving Idea…
I’ve been chewing on this problem for a while. I’m working on a Settings Page to replace the constants in the config file. It is basically the same as, “What if I change my settings from 62 to 36?” (uppercase, lowercase, and numbers, to only lowercase and numbers?) It also fails on the uppercase letters.
I believe setting changes should not cause failures.
DB Entries Are Legal
The solution is simple, make all entries in the DB legal. This would mean setting changes would not break anything. If you had settings of 62, plus hyphens, plus exclamation points and a keyword
Something-Special!
Then changed to a strict 36 only, your keywordSomething-Special!
would continue to work.If it is in the DB and you don’t want it, just delete it.
Automatic Only
Use the restriction settings only in the making of short URLs during automatic mode.
Allow Manual Override
When adding or editing a short URL MANUALLY, you should have the power of adding characters outside of the restricted range prescribed in settings for automatic URLs. Perhaps with a warning!
@ozh - Just a flash idea…
Perhaps leave the Admin basically the same with the added ability to delete any entry. Likewise, when the shortened URL was serviced, maybe we should check anything against the DB. For example, we add the keyword 123-XYZ to the Database. Then remove the hyphen plugin. 123-XYZ could be allowed to work IF it is already in the DB, just no new hyphen keys would be allowed to be added.
Just a thought.