lib/modulesync/git_service/base.rb in modulesync-2.3.1 vs lib/modulesync/git_service/base.rb in modulesync-2.4.0
- old
+ new
@@ -39,10 +39,10 @@
# Returns nil if
# - /path/to/repo.git/
# - file:///path/to/repo.git/
# - any invalid URL
def self.extract_hostname(url)
- return nil if url.start_with?('/') || url.start_with?('file://') # local path (e.g. file:///path/to/repo)
+ return nil if url.start_with?('/', 'file://') # local path (e.g. file:///path/to/repo)
unless url.start_with?(%r{[a-z]+://}) # SSH notation does not contain protocol (e.g. user@server:path/to/repo/)
pattern = /^(?<user>.*@)?(?<hostname>[\w|.]*):(?<repo>.*)$/ # SSH path (e.g. user@server:repo)
return url.match(pattern)[:hostname] if url.match?(pattern)
end