diff options
Diffstat (limited to 'lib/gitlab/uuid.rb')
-rw-r--r-- | lib/gitlab/uuid.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab/uuid.rb b/lib/gitlab/uuid.rb index 12a4efabc44..80caf2c6788 100644 --- a/lib/gitlab/uuid.rb +++ b/lib/gitlab/uuid.rb @@ -9,6 +9,7 @@ module Gitlab production: "58dc0f06-936c-43b3-93bb-71693f1b6570" }.freeze + UUID_V5_PATTERN = /\h{8}-\h{4}-5\h{3}-\h{4}-\h{4}\h{8}/.freeze NAMESPACE_REGEX = /(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})/.freeze PACK_PATTERN = "NnnnnN".freeze @@ -17,6 +18,10 @@ module Gitlab Digest::UUID.uuid_v5(namespace_id, name) end + def v5?(string) + string.match(UUID_V5_PATTERN).present? + end + private def default_namespace_id |