[openstreetmap/openstreetmap-website] Ignore invalid object IDs in various redirects (PR #7372)

Pablo Brasero notifications at github.com
Wed Sep 9 10:21:01 UTC 2026


@pablobm commented on this pull request.



> @@ -44,13 +44,13 @@ def permalink
 
     options = new_params.to_unsafe_h.to_options
 
-    path = if params.key? :node
+    path = if params[:node]&.match(/^\d+$/)

How about some sort of helper to avoid repeating the regexp, etc?

```ruby
    path = if valid_id?(params[:node])

  # ...

  def valid_id?(candidate)
    candidate && candidate.match?(/^\d+$/)
  end
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7372#pullrequestreview-5152909040
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7372/review/5152909040 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260909/0f2a7aa8/attachment-0001.htm>


More information about the rails-dev mailing list