Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-10 06:07:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-10 06:07:25 +0300
commit4a6dacc8662ed65c0b83a3715e4eb05a78168db1 (patch)
tree04aced9d7d60c1213db9d5152158afe02126599f /lib/gitlab/safe_device_detector.rb
parent070ac34d473978dc27ea2878ed1cf17865e24e9a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/safe_device_detector.rb')
-rw-r--r--lib/gitlab/safe_device_detector.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/safe_device_detector.rb b/lib/gitlab/safe_device_detector.rb
new file mode 100644
index 00000000000..ba1010ae5e4
--- /dev/null
+++ b/lib/gitlab/safe_device_detector.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+# rubocop:disable Gitlab/NamespacedClass
+require 'device_detector'
+
+module Gitlab
+ class SafeDeviceDetector < ::DeviceDetector
+ USER_AGENT_MAX_SIZE = 1024
+
+ def initialize(user_agent)
+ super(user_agent)
+ @user_agent = user_agent && user_agent[0..USER_AGENT_MAX_SIZE]
+ end
+ end
+end
+
+# rubocop:enable Gitlab/NamespacedClass