SinTan1729/chhoto-url

It is possible to create short links with '/' in them which cannot be deleted

Closed this issue · 2 comments

Describe the bug
It is possible to create short links with '/' in them which cannot be deleted

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'http://localhost:4567'
  2. Enter any long URL
  3. Enter short url 'some/path'
  4. Click 'Shorten!'
  5. Attempt to delete the newly created URL
  6. Attempt to navigate to 'http://localhost:4567/some/path'

Expected behavior
Any short URL created should be deletable. Editing the REST call to replace '/' with '%2F' works to delete it.

Possible solutions:

  • Add support for URLs with slashes
    • Update the page JS to URL escape characters in the delete request
    • Update resolver to handle these as well
  • Block creation of such URLs

Supporting

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Firefox
  • Version 123.0.1

Thank you for the bug report. I decided to go with blocking such URLs. This was already supposed to be the case but I goofed up the regex string for checking validity. I just pushed a commit potentially fixing this. Can you check and let me know if this fixed the issue for you?

Perfect, that worked for me. Thanks!