gitlab-org--gitlab-foss/app/services/projects/import_error_filter.rb

15 lines
422 B
Ruby
Raw Normal View History

2018-12-05 13:31:43 +00:00
# frozen_string_literal: true
module Projects
# Used by project imports, it removes any potential paths
# included in an error message that could be stored in the DB
class ImportErrorFilter
2019-05-05 10:19:14 +00:00
ERROR_MESSAGE_FILTER = /[^\s]*#{File::SEPARATOR}[^\s]*(?=(\s|\z))/.freeze
2018-12-05 13:31:43 +00:00
FILTER_MESSAGE = '[FILTERED]'
def self.filter_message(message)
message.gsub(ERROR_MESSAGE_FILTER, FILTER_MESSAGE)
end
end
end