aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/utils.go')
-rw-r--r--modules/git/utils.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/git/utils.go b/modules/git/utils.go
index 0d67412707..53211c6451 100644
--- a/modules/git/utils.go
+++ b/modules/git/utils.go
@@ -4,6 +4,8 @@
package git
import (
+ "crypto/sha1"
+ "encoding/hex"
"fmt"
"io"
"os"
@@ -128,3 +130,9 @@ func (l *LimitedReaderCloser) Read(p []byte) (n int, err error) {
func (l *LimitedReaderCloser) Close() error {
return l.C.Close()
}
+
+func HashFilePathForWebUI(s string) string {
+ h := sha1.New()
+ _, _ = h.Write([]byte(s))
+ return hex.EncodeToString(h.Sum(nil))
+}