EmberJS router, dynamic segments, and percent-encoded forward-slash

I’ve been trying to use a slash character as a segment of a dynamic route, but EmberJs doesn’t like that. I’ve tried using %2F instead, as that should be considered an escaped slash, but EmberJs is already recognizing that as a slash as well (and throwing “unrecognized route” type errors). I’m not sure if that’s intended… given that %2F is supposed to be an “escaped” forward slash, it doesn’t seem like it’s the sort of thing it should be doing, unless there’s a really good reason for it.

Could somebody with more detailed experience please provide additional information about this scenario?

Hey @dgbonomo, I put a bounty on my question on Stackoverflow and I got an aswer How to handle search queries that contain "/" in Ember.js apps? - Stack Overflow

Can you please try it and let me know if it works?

Hi @tarasm. I actually did try that before I posted. It doesn’t seem to work, presumably because the special characters seem to be decoded by what I guess is Ember itself (but I’m not 100% sure if that’s accurate). You can try this by typing a %2F in the URL on your own as well, the %2F is automatically changed into a forward slash (trying it on any old static page will show you that this doesn’t normally happen on its own).

He seems confident that this is the solution. I’m going to try it myself as soon as I get a chance to.

It would be better if we had a “:everything_past_this_point” type dynamic segment, perhaps then Ember wouldn’t be as confused, but I’m not sure if that exists or is doable, or whether all the above is a bug to begin with. I’d still appreciate your retesting the suggestion in case I missed something; but at the moment the solution seems to be “do not use forward slashes”. Even if %2F was usable, it wouldn’t be very readable - people would have a hard time figuring out what the URL says, and an unnecessarily hard time adjusting it. Unless the “everything past this” is possible, it seems like it’s better to replace forward slashes with another easily readable character (backslash or dash). It’s less ideal and more involved from a technical code perspective, but at least it’s more acceptable in terms of usability.

I’ll give it a look as soon as I get a chance.

But not using / does seem like a reasonable solution. Even converting date / to -