Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/projects/update_remote_mirror_service.rb')
-rw-r--r--app/services/projects/update_remote_mirror_service.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/projects/update_remote_mirror_service.rb b/app/services/projects/update_remote_mirror_service.rb
index 5c41f00aac2..40cf916e2f5 100644
--- a/app/services/projects/update_remote_mirror_service.rb
+++ b/app/services/projects/update_remote_mirror_service.rb
@@ -2,12 +2,14 @@
module Projects
class UpdateRemoteMirrorService < BaseService
+ include Gitlab::Utils::StrongMemoize
+
MAX_TRIES = 3
def execute(remote_mirror, tries)
return success unless remote_mirror.enabled?
- if Gitlab::UrlBlocker.blocked_url?(CGI.unescape(Gitlab::UrlSanitizer.sanitize(remote_mirror.url)))
+ if Gitlab::UrlBlocker.blocked_url?(normalized_url(remote_mirror.url))
return error("The remote mirror URL is invalid.")
end
@@ -27,6 +29,12 @@ module Projects
private
+ def normalized_url(url)
+ strong_memoize(:normalized_url) do
+ CGI.unescape(Gitlab::UrlSanitizer.sanitize(url))
+ end
+ end
+
def update_mirror(remote_mirror)
remote_mirror.update_start!
remote_mirror.ensure_remote!