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