summaryrefslogtreecommitdiffstats
path: root/api/file.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-07-17 15:55:06 -0400
committerJoramWilander <jwawilander@gmail.com>2015-07-21 19:22:04 -0400
commitc63fbd4ccc5e7a11c4ce15fe7d19a3daf4e5c45e (patch)
tree86c79a43ded7407c2c9b955072f225762721b2d0 /api/file.go
parentedf26b4bc6f997d3dc2927b24e5787e6f66f2eb6 (diff)
downloadchat-c63fbd4ccc5e7a11c4ce15fe7d19a3daf4e5c45e.tar.gz
chat-c63fbd4ccc5e7a11c4ce15fe7d19a3daf4e5c45e.tar.bz2
chat-c63fbd4ccc5e7a11c4ce15fe7d19a3daf4e5c45e.zip
add proper url encoding for filenames
Diffstat (limited to 'api/file.go')
-rw-r--r--api/file.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/api/file.go b/api/file.go
index 4fead4627..2abaca709 100644
--- a/api/file.go
+++ b/api/file.go
@@ -103,7 +103,9 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
imageDataList = append(imageDataList, buf.Bytes())
}
- fileUrl := "/" + channelId + "/" + c.Session.UserId + "/" + uid + "/" + url.QueryEscape(files[i].Filename)
+ encName := utils.UrlEncode(files[i].Filename)
+
+ fileUrl := "/" + channelId + "/" + c.Session.UserId + "/" + uid + "/" + encName
resStruct.Filenames = append(resStruct.Filenames, fileUrl)
}
@@ -264,6 +266,7 @@ func asyncGetFile(path string, fileData chan []byte) {
go func() {
data, getErr := readFile(path)
if getErr != nil {
+ l4g.Error(getErr)
fileData <- nil
} else {
fileData <- data