summaryrefslogtreecommitdiff
path: root/app/controllers/import/github_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/import/github_controller.rb')
-rw-r--r--app/controllers/import/github_controller.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb
index cb58b5974ca..9a8f6a74653 100644
--- a/app/controllers/import/github_controller.rb
+++ b/app/controllers/import/github_controller.rb
@@ -150,7 +150,7 @@ class Import::GithubController < Import::BaseController
end
def client_repos_response
- @client_repos_response ||= client_proxy.repos(sanitized_filter_param, pagination_options)
+ @client_repos_response ||= client_proxy.repos(sanitized_filter_param, fetch_repos_options)
end
def client_repos
@@ -160,7 +160,11 @@ class Import::GithubController < Import::BaseController
def sanitized_filter_param
super
- @filter = @filter&.tr(' ', '')&.tr(':', '')
+ @filter = sanitize_query_param(@filter)
+ end
+
+ def sanitize_query_param(value)
+ value.to_s.first(255).gsub(/[ :]/, '')
end
def verify_import_enabled
@@ -222,6 +226,10 @@ class Import::GithubController < Import::BaseController
head :too_many_requests
end
+ def fetch_repos_options
+ pagination_options.merge(relation_options)
+ end
+
def pagination_options
{
before: params[:before].presence,
@@ -233,6 +241,13 @@ class Import::GithubController < Import::BaseController
per_page: PAGE_LENGTH
}
end
+
+ def relation_options
+ {
+ relation_type: params[:relation_type],
+ organization_login: sanitize_query_param(params[:organization_login])
+ }
+ end
end
Import::GithubController.prepend_mod_with('Import::GithubController')