Merge branch 'sanitize-new-project-error-message' into 'master'
Sanitize repo paths in new project error message Closes #17243 See merge request !4029
This commit is contained in:
commit
915a4193b4
4 changed files with 17 additions and 1 deletions
|
@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
|
|||
v 8.8.0 (unreleased)
|
||||
- Project#open_branches has been cleaned up and no longer loads entire records into memory.
|
||||
- Make build status canceled if any of the jobs was canceled and none failed
|
||||
- Sanitize repo paths in new project error message
|
||||
- Remove future dates from contribution calendar graph.
|
||||
- Support e-mail notifications for comments on project snippets
|
||||
- Use ActionDispatch Remote IP for Akismet checking
|
||||
|
|
|
@ -341,4 +341,10 @@ module ProjectsHelper
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
def sanitize_repo_path(message)
|
||||
return '' unless message.present?
|
||||
|
||||
message.strip.gsub(Gitlab.config.gitlab_shell.repos_path.chomp('/'), "[REPOS PATH]")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
.panel-body
|
||||
%pre
|
||||
:preserve
|
||||
#{@project.import_error.try(:strip)}
|
||||
#{sanitize_repo_path(@project.import_error)}
|
||||
|
||||
= form_for @project, url: namespace_project_import_path(@project.namespace, @project), method: :post, html: { class: 'form-horizontal' } do |f|
|
||||
= render "shared/import_form", f: f
|
||||
|
|
|
@ -131,4 +131,13 @@ describe ProjectsHelper do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#sanitized_import_error' do
|
||||
it 'removes the repo path' do
|
||||
repo = File.join(Gitlab.config.gitlab_shell.repos_path, '/namespace/test.git')
|
||||
import_error = "Could not clone #{repo}\n"
|
||||
|
||||
expect(sanitize_repo_path(import_error)).to eq('Could not clone [REPOS PATH]/namespace/test.git')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue