| 29 | } |
| 30 | |
| 31 | func (p *Project) WebURL(name, owner, path string) string { |
| 32 | if owner == "" { |
| 33 | owner = p.Owner |
| 34 | } |
| 35 | if name == "" { |
| 36 | name = p.Name |
| 37 | } |
| 38 | |
| 39 | ownerWithName := fmt.Sprintf("%s/%s", owner, name) |
| 40 | if strings.Contains(ownerWithName, ".wiki") { |
| 41 | ownerWithName = strings.TrimSuffix(ownerWithName, ".wiki") |
| 42 | if path != "wiki" { |
| 43 | if strings.HasPrefix(path, "commits") { |
| 44 | path = "_history" |
| 45 | } else if path != "" { |
| 46 | path = fmt.Sprintf("_%s", path) |
| 47 | } |
| 48 | |
| 49 | if path != "" { |
| 50 | path = utils.ConcatPaths("wiki", path) |
| 51 | } else { |
| 52 | path = "wiki" |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | url := fmt.Sprintf("%s://%s", p.Protocol, utils.ConcatPaths(p.Host, ownerWithName)) |
| 58 | if path != "" { |
| 59 | url = utils.ConcatPaths(url, path) |
| 60 | } |
| 61 | |
| 62 | return url |
| 63 | } |
| 64 | |
| 65 | func (p *Project) GitURL(name, owner string, isSSH bool) (url string) { |
| 66 | if name == "" { |