[openstreetmap/openstreetmap-website] Allow `user/preferences/[KEY]` to accept arbitrary keys (PR #3787)
Andy Allan
notifications at github.com
Fri Nov 18 14:36:49 UTC 2022
> The problem is that `user/preferences/gps.trace.visibility` will lead to a routing error (it cannot find the route) if `resources` is used.
But I still don't understand what you are trying to achieve! I thought we'd clarified that we can't use any unescaped `.` characters from the keys in the urls, since we need `.` for the format separator. So whether rails resource matching can parse multiple `.` in the url isn't going to affect us - the only `.` we will see in the url will be the format separator. Not any `.` from a key.
If you are trying to support both (optional) format extensions and also dotted-keys in the url, then I believe that's a dead-end. You can't distinguish these two different situations:
* `/user/preferences/foo.json` - a request for the `foo` key, response should be json format
* `/user/preferences/foo.json` - a request for the `foo.json` key
Similarly if you consider keys with multiple `.` characters
* `/user/preferences/foo.bar.xml` - a request for the `gps.visibility.xml` key
* `/user/preferences/foo.bar.xml` - a request for the `gps.visibility` key in XML format
I don't want to see a special-case for the User Preferences API along the lines of "please note that if you have a `.` in your key and also the characters after the final dot happen to match one of the formats that we support (currently `xml` and `json`) then your key cannot be accessed through the direct users preferences API" or something like this. Reading between the lines, I think that's what you might be trying to achieve, but it's not clear to me.
I don't want you to spend more of your time and effort working on debugging something that turns out to be a dead end or not useful, so I recommend that we clarify what you are trying to do before you jump in with more coding.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3787#issuecomment-1320078854
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/3787/c1320078854 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20221118/792e25dc/attachment.htm>
More information about the rails-dev
mailing list