mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:24:35 +08:00
Move logic to reject slugs that are just numbers into the slug module
This commit is contained in:
@ -6,7 +6,8 @@
|
||||
module Slug
|
||||
|
||||
def self.for(string)
|
||||
string.parameterize.gsub("_", "-")
|
||||
slug = string.parameterize.gsub("_", "-")
|
||||
slug =~ /[^\d]/ ? slug : '' # Reject slugs that only contain numbers, because they would be indistinguishable from id's.
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user