#3802·YOURLS

Backslashes are stripped from URL

Author: jcubicCreated Aug 31, 2024Updated May 31, 2026
Labelsbug

Code of Conduct

Submission validity

  • This is not a personal support request, that should be posted on discussions community.
  • I checked current issues and this request isn't a duplicate of an existing issue, opened or closed.

Self troubleshooting

Version

1.9.2

Description

When shortening the ULR that contain slashes YOURLS strip them when saving to database.

Expectation

I have application that contain JSON in URL hash if the strings contain quotations the ULR doesn't work when using shortener. Because " inside string in JSON become \" and YOURLS saves " and you end up with invalid JSON.

Reproduction steps

  1. Add this URL: https://terminal.jcubic.pl/404#[[0,1,%22jargon%20\%22Don't%20do%20that%20then!\%22%22]] that should run a command in the terminal
  2. Open the short link
  3. The command don't appear (the web app ignores any JSON errors)

Context

I think that the tool should not do any manipulation to the URL hash, it should always be passed as is. Of course, with escapes and unescapes when writing and reading from database.

Browser do some escaping when copying full URL, here is same URL with hash copied separately, so there are no escaping:

https://terminal.jcubic.pl/404#[[0,1,"jargon%20\"Don't%20do%20that%20then!\""]]

As you can see, there is \" in the hash. When copying this URL quotations and backsplashed are removed.