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

safe_device_detector.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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