Opened 7 years ago

Closed 7 years ago

#4471 closed defect (fixed)

Attempt to remove all members from a relation is silently ignored

Reported by: woodpeck Owned by: rails-dev@…
Priority: minor Milestone:
Component: api Version:
Keywords: Cc:

Description

An attempt to remove all members from a relation (by uploading a new version with no members) results in no change - the relation will be updated with a new version and new user/last modification data, but it will still have all its members.

Simple test case (modify object/changeset IDs accordingly):

<osmChange version="0.6">
  <create>
    <node id="-1" lat="45.0809152" lon="-87.6450209" changeset="zzz" visible="true" timestamp="2012-05-10T23:28:27Z" version="1"/>
    <relation id="-2" visible="true" timestamp="2012-05-12T23:47:18Z" version="1" changeset="zzz">
      <member type="node" ref="-1" role="x"/>
    </relation>
  </create>
</osmChange>

later

<osmChange version="0.6">
  <modify>
    <relation id="xxx" visible="true" timestamp="2012-05-12T23:47:18Z" version="1" changeset="zzz" />
  </modify>
</osmChange>

this results in

<diffResult version="0.6" generator="OpenStreetMap server">
  <relation old_id="xxx" new_id="xxx" new_version="2"/>
</diffResult>

but the relation is unchanged!

It is possible that the bug is related to the "unless @members" https://github.com/openstreetmap/openstreetmap-website/blob/master/app/models/relation.rb#L164 but I cannot say for sure.

The bug can be circumvented by deleting a relation (which will clear the member list) and then undeleting it through a <modify>.

Relations without members should be allowed even though their uses are probably niche cases.

Change History (1)

comment:1 Changed 7 years ago by Tom Hughes

Resolution: fixed
Status: newclosed

Matt has fixed this in commit 8523f530990932.

Note: See TracTickets for help on using tickets.