Comment

Comment by darklajid

I realize criticism is cheap, and I like seeing small projects like this to explore other people's mind, but:

What's the reason for the valid_url_pattern in shortener.js?

/https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?/

Why? This seems to be broken by design (I can construct invalid urls that match and find valid urls that don't. What's the idea behind this expression, why is it necessary?

And looking at the code it just seems to prepend 'http:// to the url if it doesn't match this expression?

parent darklajid 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton