-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
Allow checking for duplicated long URLs when creating a short URL #279
Comments
That used to be the default behavior, and it was changed at some point, since users wanted to be able to get different short links to the same destination (to compare the most successful options). Also, since there are several metadata for a link (slug, visits limit, dates...), there are more checks than just see if the long URL is used, in order to find out if the user is duplicating data. That said, I think it is a reasonable feature, so I will try to provide a nice and consistent way to be able to avoid new short URLs to be created for the same long URL. I also had in mind allowing to "merge" already created short URLs, as long as they have the same short URL. |
Ok in many shorten-url services the default behavior is to have 1-1. I'll be pleased if you can provide an easy boolean switch 1-1/1-N. Very nice product by the way, thanks ! |
Thanks :) |
Hey @jr-k, I have started defining all the use cases for this feature, and I would appreciate your feedback. This list defines all the combinations that could happen when the new flag is provided, and how I plan to make shlink behave. Considerations:
When providing this new flag:
Edge cases:
|
Seems nice ! Happy to hear that you're actively working on this. Well, all these cases seems ok to me. For the edge case two possiblities :
Do you see any other ways ? |
I will probably return the newest one for now, and consider adding a breaking change and return a list in the next major release of the API. As for points 2 and 4, I wanted to know your opinion on which of the two proposed approaches should be implemented. Probably the more correct one is the second in both cases, but it might be counter intuitive. For example, if 10 months ago you created a short URL for https://google.com with no other params and now you try to create a new one for the same long URL, selecting the new flag, and providing a Would you expect the system to create a new short URL for the same long URL but with the date limit, or to get the old one which has no Another option would be to update the old one and return it, but I think it is counter intuitive too. What sense would it make to add a |
Oh yes sorry I missed these points. Yeah, 2nd options are the smartest way to do that I think. For your next question I would expect that the system return the old one with no validSince. To be honest I'm not using all these features about stats on custom links and so on, I don't really know what are the best choices for all these questions. I'm just using it in a very simple way, a unique 1-1 short-long url match service. |
Yes, I also think that's the best approach. Other options introduce unintended side effects. Also probably most of the users are almost never using those params, the same as you, so it will be the best way to go in most of the cases. Thanks a lot for your feedback. I will be working on this feature next in order to include it on next release. |
@jr-k I have just merged the pull request implementing this feature. I'm not sure when will I release v1.16, but this feature will be included :) I will also implement the feature in the web-client, but if you are using any custom implementation, you will be able to use this as soon as shlink v1.16 is released. |
thanks this is awesome ! |
Hey @jr-k I have just released Shlink 1.16, which includes this feature https://github.com/shlinkio/shlink/releases I will soon add support for it in shlink-web-client. Maybe you want to watch this issue: shlinkio/shlink-web-client#101 |
@jr-k I have just merged the task implementing a new checkbox enabling this feature in shlink-web-client. The feature will be part of v2.1.0. I hope to get it ready as soon as possible, but I'm affraid it will probable take some days. I'll let you know when it is deployed. |
Hello,
Actually when I'm generating a link like https://google.fr and if I'm generating this link many times I have different shorten urls.
Is there a POST parameter for the endpoint /rest/v1/short-urls, like "checkExists" to get the first shorten link if it exists ?
Thanks.
As decided in this issue's conversation, the feature will be implemented following these approaches for every use case:
When providing this new flag:
The text was updated successfully, but these errors were encountered: