summaryrefslogtreecommitdiffstats
path: root/model/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/utils.go')
-rw-r--r--model/utils.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/utils.go b/model/utils.go
index 03215490d..d9b06bd01 100644
--- a/model/utils.go
+++ b/model/utils.go
@@ -386,3 +386,17 @@ func IsValidHttpsUrl(rawUrl string) bool {
return true
}
+
+func IsSafeLink(link *string) bool {
+ if link != nil {
+ if IsValidHttpUrl(*link) {
+ return true
+ } else if strings.HasPrefix(*link, "/") {
+ return true
+ } else {
+ return false
+ }
+ }
+
+ return true
+}