aboutsummaryrefslogtreecommitdiff
path: root/internal/pathutil/pathutil.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pathutil/pathutil.go')
-rw-r--r--internal/pathutil/pathutil.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/pathutil/pathutil.go b/internal/pathutil/pathutil.go
new file mode 100644
index 00000000..6a7286e1
--- /dev/null
+++ b/internal/pathutil/pathutil.go
@@ -0,0 +1,15 @@
+// Copyright 2020 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package pathutil
+
+import (
+ "path"
+ "strings"
+)
+
+// Clean cleans up given path and returns a relative path that goes straight down.
+func Clean(p string) string {
+ return strings.Trim(path.Clean("/"+p), "/")
+}