Module: ImportUrlParams

Included in:
Projects::ImportsController, ProjectsController
Defined in:
app/controllers/concerns/import_url_params.rb

Instance Method Summary collapse

Instance Method Details

#import_params_to_full_url(params) ⇒ Object


16
17
18
19
20
21
22
23
24
# File 'app/controllers/concerns/import_url_params.rb', line 16

def import_params_to_full_url(params)
  Gitlab::UrlSanitizer.new(
    params[:import_url],
    credentials: {
      user: params[:import_url_user],
      password: params[:import_url_password]
    }
  ).full_url
end

#import_url_paramsObject


4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/concerns/import_url_params.rb', line 4

def import_url_params
  return {} unless params.dig(:project, :import_url).present?

  {
    import_url: import_params_to_full_url(params[:project]),
    # We need to set import_type because attempting to retry an import by URL
    # could leave a stale value around. This would erroneously cause an importer
    # (e.g. import/export) to run.
    import_type: 'git'
  }
end