summaryrefslogtreecommitdiff
path: root/lib/gitlab/safe_device_detector.rb
blob: ba1010ae5e4fde8b58d37ffbea880f05f926bfbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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