blink icon indicating copy to clipboard operation
blink copied to clipboard

Certain links aren't shortened correctly.

Open HrBingR opened this issue 2 years ago • 1 comments

Current Behavior: Certain links (likely due to certain characters in the link) don't shorten in their entirety, so only part of the link is shortened which leads to invalid links.

Expected Behavior: The full link should be shortened.

Tested Using (and the entire reason I need a link shortener): A self-hosted version of Send, a fork of Mozilla Send after the original project was shut down. Link to Project (Not a Maintainer): https://github.com/timvisee/send Public link to my self-hosted version: https://fileshare.thenextweb.co.za

Example:

This is the link being given to Blink: https://fileshare.thenextweb.co.za/download/02d94d2716174801/#By5L1kTLo7msxWTwHAKzhw

This is the link that Blink creates a shortened link for:

https://fileshare.thenextweb.co.za/download/02d94d2716174801

The full link is being provided to Blink, but either the / or the # in the link is preventing Blink from shortening the full URL, instead only shortening the first part, which leads to an invalid URL.

Note: The above links are active and can be used for testing, but feel free to upload your own file for testing as well, using the public link above.

Side note: Much like #742 I also have the following problems, though haven't investigated why, and haven't tested all of the other points made by that user:

  • QR code is broken, doesn't display, only shows a broken image icon (like this: https://www.thewindowsclub.com/wp-content/uploads/2018/06/Broken-image-icon-in-Chrome.gif)
  • After deleting a link I get pop up toast that says Cannot read properties of undefined (reading ‘id’).
  • After creating link it doesn’t show up unless click refresh button, should auto update.

Let me know if there's anything that needs doing from my side to assist in troubleshooting these.

HrBingR avatar Aug 04 '22 20:08 HrBingR

As for the most pressing issue, the hash stripping happens by default due to it being part of the normalization process - semantically, hashes aren't supposed to be used for anything that changes the behaviour of the link, and yet Send does (so it is actually the bad actor in this case).

If you want to change the behaviour, you'd need a way to override the config here: https://github.com/JaneJeon/blink/blob/5f92d8b815d8c33271c6de557294b4c75612f148/models/link.js#L50 (it's based on normalize-url - you can lookup that library's options).

As for the rest, it's going to take a while - I'm still going through major cleanups and stuff in life, so I don't expect to be able to spend time debugging this, and would appreciate effort on your part.

For all of the issues (QR code, deleting, creating), please do the following and report back (because I see none of these behaviours when I run them locally):

  • try running Blink locally (instructions in the README). Do the 3 behaviours still appear?
  • if not, what version of Blink container are you using? A prebuilt docker image (if so, tag) or a custom build?

JaneJeon avatar Aug 05 '22 21:08 JaneJeon

For now, will close as a wontfix. Perhaps I will create a separate field for storing "original" vs. "original + non-normalized bits" URLs separately in a v2, but it is simply out of scope for a v1.

JaneJeon avatar Sep 28 '22 18:09 JaneJeon