debian-mirror-gitlab/lib/gitlab/git/pre_receive_error.rb

24 lines
551 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
module Gitlab
module Git
#
# PreReceiveError is special because its message gets displayed to users
2019-05-30 16:15:17 +05:30
# in the web UI. To prevent XSS we sanitize the message on
# initialization.
2018-11-08 19:23:39 +05:30
class PreReceiveError < StandardError
2019-05-30 16:15:17 +05:30
def initialize(msg = '')
super(nlbr(msg))
2018-11-08 19:23:39 +05:30
end
private
# In gitaly-ruby we override this method to do nothing, so that
# sanitization happens in gitlab-rails only.
2019-05-30 16:15:17 +05:30
def nlbr(str)
Gitlab::Utils.nlbr(str)
2018-11-08 19:23:39 +05:30
end
end
end
end