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

pre_receive_error.rb « git « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 03caace6fce4dede72832716134085cef3d7a102 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Gitlab
  module Git
    #
    # PreReceiveError is special because its message gets displayed to users
    # in the web UI. To prevent XSS we sanitize the message on
    # initialization.
    class PreReceiveError < StandardError
      def initialize(msg = '')
        super(nlbr(msg))
      end

      private

      # In gitaly-ruby we override this method to do nothing, so that
      # sanitization happens in gitlab-rails only.
      def nlbr(str)
        Gitlab::Utils.nlbr(str)
      end
    end
  end
end