debian-mirror-gitlab/app/services/projects/import_error_filter.rb

15 lines
422 B
Ruby
Raw Normal View History

2019-02-02 18:00:53 +05:30
# 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-07-31 22:56:46 +05:30
ERROR_MESSAGE_FILTER = /[^\s]*#{File::SEPARATOR}[^\s]*(?=(\s|\z))/.freeze
2019-02-02 18:00:53 +05:30
FILTER_MESSAGE = '[FILTERED]'
def self.filter_message(message)
message.gsub(ERROR_MESSAGE_FILTER, FILTER_MESSAGE)
end
end
end