From 287d0dbd75622e59f156eea29aba26b681b1a692 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 23 Jun 2013 14:44:16 +1000 Subject: [PATCH] bad locale files could lead to broken automatic groups --- app/models/group.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/group.rb b/app/models/group.rb index d4fca9fa2..94685f3a9 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -36,6 +36,12 @@ class Group < ActiveRecord::Base group.name = I18n.t("groups.default_names.#{name}") + # don't allow shoddy localization to break this + validator = UsernameValidator.new(group.name) + unless validator.valid_format? + group.name = name + end + real_ids = case name when :admins "SELECT u.id FROM users u WHERE u.admin"