]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/relation.rb
Fixed problem where tag lengths were generating a 422 error with no message. They...
[rails.git] / app / models / relation.rb
index 7be027559883c1e0f42a8f2b9f7c5a0ee5d49225..24b139f0ddd33dbe34ebe85634fabf0904bc48b5 100644 (file)
@@ -218,6 +218,11 @@ class Relation < ActiveRecord::Base
     # in the hash to be overwritten.
     raise OSM::APIDuplicateTagsError.new("relation", self.id, k) if @tags.include? k
 
+    # check tag size here, as we don't create a RelationTag object until
+    # just before we save...
+    raise OSM::APIBadUserInput.new("Relation #{self.id} has a tag with too long a key, '#{k}'.") if k.length > 255
+    raise OSM::APIBadUserInput.new("Relation #{self.id} has a tag with too long a value, '#{k}'='#{v}'.") if v.length > 255
+
     @tags[k] = v
   end