summaryrefslogtreecommitdiffstats
path: root/utils/urlencode.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-07-21 15:46:12 -0800
committerCorey Hulen <corey@hulen.com>2015-07-21 15:46:12 -0800
commit269185fb0e252e8105d5f143ca104a069ec10c47 (patch)
tree37eb1f616abcd5a923d8c730b9f7a6d1b5b56f2d /utils/urlencode.go
parent06bac01e882a7b05519d0e39bccafacd0c27c602 (diff)
parent237920e314f3974880d9913aff69faafbe094107 (diff)
downloadchat-269185fb0e252e8105d5f143ca104a069ec10c47.tar.gz
chat-269185fb0e252e8105d5f143ca104a069ec10c47.tar.bz2
chat-269185fb0e252e8105d5f143ca104a069ec10c47.zip
Merge pull request #205 from mattermost/mm-1351
fixes mm-1351 adds local server storage
Diffstat (limited to 'utils/urlencode.go')
-rw-r--r--utils/urlencode.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/urlencode.go b/utils/urlencode.go
new file mode 100644
index 000000000..63a8f7880
--- /dev/null
+++ b/utils/urlencode.go
@@ -0,0 +1,19 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package utils
+
+import (
+ "net/url"
+ "strings"
+)
+
+func UrlEncode(str string) string {
+ strs := strings.Split(str, " ")
+
+ for i, s := range strs {
+ strs[i] = url.QueryEscape(s)
+ }
+
+ return strings.Join(strs, "%20")
+}