MAPC / dyee-dashboard

0 stars 0 forks source link

Some of the URLs for external apps might not work #18

Open allthesignals opened 7 years ago

allthesignals commented 7 years ago

Some of the URLs don't prefix https or http, so the browser thinks it's a relative path.

allthesignals commented 7 years ago

@mzagaja this might be something that can be handled on the backend too - there are javascript things to do, but I worry about adding more javascript libraries to handle one edge case. Do you know how we can validate this in the rails app? If so, I can move this issue over. Otherwise I'll just drop in https://code.google.com/archive/p/js-uri/.

allthesignals commented 7 years ago

Here's a regex that works, but I worry about unpredictability with it!

if (!s.match(/^[a-zA-Z]+:\/\//))
{
    s = 'http://' + s;
}