mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
add proper url encoding for filenames
This commit is contained in:
19
utils/urlencode.go
Normal file
19
utils/urlencode.go
Normal 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")
|
||||
}
|
||||
Reference in New Issue
Block a user