From 99463287618b61f76d157b572a670e9237d80a43 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Tue, 17 Jul 2018 13:30:06 +0200 Subject: [PATCH] Remove sanitize_repo_path This method is unneeded given its been pushed to Gitaly, through https://gitlab.com/gitlab-org/gitaly/merge_requests/780 Closes https://gitlab.com/gitlab-org/gitaly/issues/1235 --- app/helpers/projects_helper.rb | 14 ------------ app/views/projects/imports/new.html.haml | 2 +- spec/helpers/projects_helper_spec.rb | 27 ------------------------ 3 files changed, 1 insertion(+), 42 deletions(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index b0f381db5ab..221f1aa9dd8 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -413,20 +413,6 @@ module ProjectsHelper @ref || @repository.try(:root_ref) end - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1235 - def sanitize_repo_path(project, message) - return '' unless message.present? - - exports_path = File.join(Settings.shared['path'], 'tmp/project_exports') - filtered_message = message.strip.gsub(exports_path, "[REPO EXPORT PATH]") - - disk_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do - Gitlab.config.repositories.storages[project.repository_storage].legacy_disk_path - end - - filtered_message.gsub(disk_path.chomp('/'), "[REPOS PATH]") - end - def project_child_container_class(view_path) view_path == "projects/issues/issues" ? "prepend-top-default" : "project-show-#{view_path}" end diff --git a/app/views/projects/imports/new.html.haml b/app/views/projects/imports/new.html.haml index 16c4f21279d..ca82054d799 100644 --- a/app/views/projects/imports/new.html.haml +++ b/app/views/projects/imports/new.html.haml @@ -10,7 +10,7 @@ .card-body %pre :preserve - #{h(sanitize_repo_path(@project, @project.import_error))} + #{h(@project.import_error)} = form_for @project, url: project_import_path(@project), method: :post do |f| = render "shared/import_form", f: f diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index beb6e8ea273..cbd4ff0fb4a 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -290,33 +290,6 @@ describe ProjectsHelper do end end - describe '#sanitizerepo_repo_path' do - let(:project) { create(:project, :repository) } - let(:storage_path) do - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - Gitlab.config.repositories.storages.default.legacy_disk_path - end - end - - before do - allow(Settings.shared).to receive(:[]).with('path').and_return('/base/repo/export/path') - end - - it 'removes the repo path' do - repo = File.join(storage_path, 'namespace/test.git') - import_error = "Could not clone #{repo}\n" - - expect(sanitize_repo_path(project, import_error)).to eq('Could not clone [REPOS PATH]/namespace/test.git') - end - - it 'removes the temporary repo path used for uploads/exports' do - repo = '/base/repo/export/path/tmp/project_exports/uploads/test.tar.gz' - import_error = "Unable to decompress #{repo}\n" - - expect(sanitize_repo_path(project, import_error)).to eq('Unable to decompress [REPO EXPORT PATH]/uploads/test.tar.gz') - end - end - describe '#last_push_event' do let(:user) { double(:user, fork_of: nil) } let(:project) { double(:project, id: 1) }