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