[openstreetmap/openstreetmap-website] Wrong display of tag values (Issue #4036)
Andy Allan
notifications at github.com
Fri May 19 15:23:52 UTC 2023
Due to the way that we process semicolons as delineators for multiple values, we currently discard trailing semicolons. This isn't intentional.
The value of every tag shown is processed to some extent, the value `|white;` is handled here:
https://github.com/openstreetmap/openstreetmap-website/blob/933292167a42ffbd51d5054f640e33620456161d/app/helpers/browse_tags_helper.rb#L39
In Ruby, String#split discards any trailing null values, but this can be overridden by a passing a negative limit (i.e. to return all parts).
```ruby
irb(main):006:0> "|white;".split(";")
=> ["white"]
irb(main):007:0> "|white;".split(";", -1)
=> ["white", ""]
```
To fix this, that line needs changing, and some tests need writing to cover this example too.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/4036#issuecomment-1554749788
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/4036/1554749788 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230519/83634c7a/attachment.htm>
More information about the rails-dev
mailing list