Skip to content

Fix NamespaceUploader.base_dir for remote uploads

Jarka Košanová requested to merge fix-namespace-uploader into master

What does this MR do?

It fixes displaying files for namespaces for remote uploads. When displaying an upload following code is in UploadsController

def build_uploader_from_upload
  return unless uploader = build_uploader

  upload_paths = uploader.upload_paths(params[:filename])
  upload = Upload.find_by(uploader: uploader_class.to_s, path: upload_paths)

upload_paths array contains a path for remote and local file. Local path is ok but not the remote one and the remote one differs from the store_dir. This was because base_dir in NamespaceUploader is same for both local and remote files. I introduced base_dirs method in this uploader and this method is now being used by base_dir and also by store_dirs.

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ee/issues/7009#note_94323710

Does this MR meet the acceptance criteria?

Merge request reports