Handle ssh urls

This commit is contained in:
rubyist 2014-03-19 17:21:52 -04:00 committed by Rick Olson
parent 4248de4fec
commit c7b35e451f

@ -3,6 +3,7 @@ package gitmedia
import ( import (
"os" "os"
"path" "path"
"regexp"
"strings" "strings"
) )
@ -27,6 +28,11 @@ func (c *Configuration) RemoteEndpoint(remote string) string {
} }
if url, ok := c.GitConfig("remote." + remote + ".url"); ok { if url, ok := c.GitConfig("remote." + remote + ".url"); ok {
if !strings.HasPrefix(url, "https://") {
re := regexp.MustCompile("^.+@")
url = re.ReplaceAllLiteralString(url, "https://")
}
if path.Ext(url) == ".git" { if path.Ext(url) == ".git" {
return url + "/info/media" return url + "/info/media"
} }