mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
FIX: proper regex for category slug validation
This commit is contained in:
parent
dcd0270d52
commit
bfd21461df
@ -230,7 +230,7 @@ SQL
|
|||||||
end
|
end
|
||||||
# only allow to use category itself id. new_record doesn't have a id.
|
# only allow to use category itself id. new_record doesn't have a id.
|
||||||
unless new_record?
|
unless new_record?
|
||||||
match_id = /(\d+)-category/.match(self.slug)
|
match_id = /^(\d+)-category/.match(self.slug)
|
||||||
errors.add(:slug, :invalid) if match_id && match_id[1] && match_id[1] != self.id.to_s
|
errors.add(:slug, :invalid) if match_id && match_id[1] && match_id[1] != self.id.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user