elm-spa-example icon indicating copy to clipboard operation
elm-spa-example copied to clipboard

URI pieces should be URI encoded

Open jhrcek opened this issue 7 years ago • 2 comments

Summary: The URIs of this SPA are build just by concatenating Strings. This causes "Error Loading Page" when such a string ends up in URL.

Steps to reproduce:

  1. Register a profile with username like @#$%^&*
  2. Navigate to this user's profile by clicking the username in the top navbar.

Actual result: URL contains unescaped characters http://rtfeldman.github.io/elm-spa-example/#/profile/@#$%^&* and page shows "Error Loading Page"

Expected behavior: URL has escaped characters and profile page is shown correctly.

I was recently solving similar problem in my app and was looking for a "canonical solution" to this kind of issue and found this example app (which I'd expect to be "golden standard" of how to write SPAs in Elm) is also plagued by this issue. I ended up solving it by writing custom URL segment parser like this: https://github.com/jhrcek/random-failures/commit/e87b20b8e8d3795349758cd66912a9ad091bcd9c

jhrcek avatar Jan 02 '18 07:01 jhrcek

@jhrcek I've fixed and tested this issue in my implementation.

dwayne avatar Apr 23 '24 02:04 dwayne

That's good to know. You just got yourself a star :smile:

jhrcek avatar Apr 23 '24 04:04 jhrcek