add proper url encoding for filenames

This commit is contained in:
JoramWilander
2015-07-17 15:55:06 -04:00
parent edf26b4bc6
commit c63fbd4ccc
2 changed files with 23 additions and 1 deletions

19
utils/urlencode.go Normal file
View File

@@ -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")
}