Samagra-Development / yaus

Yet Another URL Shortner
https://github.com/Samagra-Development/yaus/wiki
11 stars 28 forks source link

Improper redirected URL , in case of params #94

Open Nazi-pikachu opened 11 months ago

Nazi-pikachu commented 11 months ago

Describe the bug When the original url has params in it the current resolveRedirect method is redirected to incorrect URL. For ex:- original url : https://example.com/?k1=v1&k2=v2&k3=v3 params : { expiry : 300 } expected redirected url = https://example.com/?k1=v1&k2=v2&k3=v3&expiry=300 actual redirected url = https://example.com/?k1=v1&k2=v2&k3=v3?expiry=300

To Reproduce Steps to reproduce the behavior:

  1. Create a shorten URL with original url having some query params
  2. Add some params like expiry
  3. Create the shorten URL
  4. See the the url getting redirected.

Expected behavior Correct URL should be like : https://example.com/?k1=v1&k2=v2&k3=v3&expiry=300

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

yuvrajsab commented 11 months ago

@Nazi-pikachu, You can quickly fix this by checking if the URL already contains query parameters. if not, then add ?k=v, or if it already has them then append it to existing parameters &k=v if it already contains it.

Nazi-pikachu commented 11 months ago

@yuvrajsab Sure i wil do this

Apurv428 commented 5 months ago

@yuvrajsab If this issue is not fixed, can I work on this?