Go to content
cutty.dev
All posts

Auto-prefix URL – a small detail that saves minutes

cutty.dev detects when you paste an address without https:// and adds it automatically. Sounds trivial. In practice, it makes the difference between two seconds of waiting and clicking try again.

In the link shortening form, you will enter allegro.pl. Most link shorteners will tell you that this is not a valid URL and ask you to re-enter it with https:// at the beginning. cutty.dev simply adds https:// itself and continues.

This sounds like a feature that barely deserves mention. In practice, it’s the difference between:

  • "I pasted it, got a short link, closed the window" (2 seconds)
  • "I pasted it, error, read the message, added https, tried again, got the link" (15-20 seconds)

Multiply by the number of times per month you paste the URL, plus the frustration of reading the error message, plus the "oh right, protocol" moment. A detail measured in minutes per person per month.

What exactly does cutty.dev do

You pasted text into the form. Before sending it to the server, JavaScript checks whether it starts with a protocol (http://, https://, ftp://, mailto: etc.). If it does not start with one — the system assumes it is simply a domain without a protocol and prepends https://.

So:

  • allegro.plhttps://allegro.pl
  • github.com/twoj-profil/projekthttps://github.com/twoj-profil/projekt
  • www.gazeta.plhttps://www.gazeta.pl

And if something already has a protocol (even if incorrect), the system leaves it as is and continues checking:

  • http://example.com → remains http://example.com (allowed)
  • ftp://example.com → rejected (only http/https)
  • javascript:alert(1) → rejected (XSS protection)

Why do I have this and others don't

Most URL shorteners perform standard URL validation via new URL(string). The URL constructor in the browser/JavaScript is strict — if there is no protocol, it throws an error. The default output for new URL("allegro.pl") is a TypeError.

This is the correct behavior for most applications. But for a link shortening form, where the user pastes a URL copied from the address bar or another application, this strictness is a hindrance rather than help.

The solution takes five lines of JavaScript:

function sanitizeUrl(input) {
  const trimmed = input.trim();
  const hasProtocol = /^[a-z][a-z0-9+.-]*:/i.test(trimmed);
  const normalized = hasProtocol ? trimmed : "https://" + trimmed;
  // dalsza walidacja przez new URL(normalized)
}

Five lines of code, a dozen seconds less frustration per user per day. I don't know why most of the market doesn't do this. Maybe because "standardly" means "the URL constructor works like that."

Details in UX are disproportionately important

cutty.dev has a dozen such things that aren't in any feature list, because each one individually sounds trivial:

  • Trim whitespace before validation — a pasted URL with trailing spaces does not cause an error
  • Hash preservedhttps://example.com/page#section keeps #section after shortening
  • Query strings preserved?utm_source=test passes through without being truncated
  • Automatic protocol upgradehttp:// to https:// when the source URL supports TLS (planned, not yet LIVE)
  • IDN domainsźdźbło.pl is automatically converted to punycode
  • Polish characters in slug — automatically converted to ASCII when creating a custom suffix (różowy-linkrozowy-link)
  • Detect dangerous protocolsjavascript:, data:, file:, mailto: are rejected with a specific message

Each of these details saves someone 5-30 seconds and a moment of irritation. Together, it makes the difference between "I like this app" and "it works OK."

What's next for UX details

List of things I want to do in the future:

  • Smart paste — detect when a user pastes text containing a URL among other words, extract only the URL
  • Bulk paste — pasting a list of URLs (one per line) creates multiple short links simultaneously
  • Suggested slugs — based on the target page title, suggest 3 branded endings to choose from
  • Auto-OG preview — show Open Graph card previews immediately after pasting the URL, before clicking the short link

Each of these is also a "five-line function that looks like nothing." Together, they distinguish between a tool that is OK and one you want to use every day.

Try it yourself

Paste somethingallegro.pl or github.com or news.ycombinator.com. The system will automatically add the protocol and proceed. No waiting, no errors, no "try again".

If this type of UX detail interests you — let me know which direction to go next. hello@cutty.dev.