Skip to content

Geo - Fix path_with_namespace for instances of Geo::DeletedProject

username-removed-283999 requested to merge fix-2726 into master

What does this MR do?

Makes Geo::DeletedProject#path_with_namespace a new copy of the overriden method Geo::DeletedProject#full_path.

Are there points in the code the reviewer needs to double check?

No.

Why was this MR needed?

The Projects::DestroyService calls project.path_with_namespace to build the wiki path, but alias_method retain access to methods that were overridden. So, project.path_with_namespace returns nil for instances of Geo::DeletedProject which raises an exception:

WARN: NoMethodError: undefined method `+` for nil:NilClass
WARN: gitlab/app/services/projects/destroy_service.rb:60:in `wiki_path`
  • Before:
pry(main)> show-source Geo::DeletedProject#path_with_namespace

From: gitlab/app/models/concerns/routable.rb @ line 103:
Owner: Project
Visibility: public
Number of lines: 6

def full_path
  return uncached_full_path unless RequestStore.active?

  key = "routable/full_path/#{self.class.name}/#{self.id}"
  RequestStore[key] ||= uncached_full_path
end
  • After:
pry(main)> show-source Geo::DeletedProject#path_with_namespace

From: gitlab/app/models/geo/deleted_project.rb @ line 17:
Owner: Geo::DeletedProject
Visibility: public
Number of lines: 3

def full_path
  @full_path
end

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #2726 (closed)

https://gitlab.com/gitlab-org/gitlab-ee/issues/2701

Edited by username-removed-283999

Merge request reports