|
|
@ -7,13 +7,11 @@ package models |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"html/template" |
|
|
|
|
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"os/exec" |
|
|
|
"os/exec" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
"regexp" |
|
|
|
|
|
|
|
"sort" |
|
|
|
"sort" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
"time" |
|
|
@ -493,18 +491,6 @@ func (repo *Repository) NextIssueIndex() int64 { |
|
|
|
return int64(repo.NumIssues+repo.NumPulls) + 1 |
|
|
|
return int64(repo.NumIssues+repo.NumPulls) + 1 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
|
|
DescPattern = regexp.MustCompile(`https?://\S+`) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DescriptionHtml does special handles to description and return HTML string.
|
|
|
|
|
|
|
|
func (repo *Repository) DescriptionHtml() template.HTML { |
|
|
|
|
|
|
|
sanitize := func(s string) string { |
|
|
|
|
|
|
|
return fmt.Sprintf(`<a href="%[1]s" target="_blank">%[1]s</a>`, s) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return template.HTML(DescPattern.ReplaceAllStringFunc(markdown.Sanitizer.Sanitize(repo.Description), sanitize)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (repo *Repository) LocalCopyPath() string { |
|
|
|
func (repo *Repository) LocalCopyPath() string { |
|
|
|
return path.Join(setting.AppDataPath, "tmp/local-repo", com.ToStr(repo.ID)) |
|
|
|
return path.Join(setting.AppDataPath, "tmp/local-repo", com.ToStr(repo.ID)) |
|
|
|
} |
|
|
|
} |
|
|
|