Use QueryUnescape function to convert to a human readable filename in email notifications
Этот коммит содержится в:
@@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/mattermost/platform/store"
|
"github.com/mattermost/platform/store"
|
||||||
"github.com/mattermost/platform/utils"
|
"github.com/mattermost/platform/utils"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -411,7 +412,12 @@ func fireAndForgetNotifications(post *model.Post, teamId, teamUrl string) {
|
|||||||
filenames := make([]string, len(post.Filenames))
|
filenames := make([]string, len(post.Filenames))
|
||||||
onlyImages := true
|
onlyImages := true
|
||||||
for i, filename := range post.Filenames {
|
for i, filename := range post.Filenames {
|
||||||
filenames[i] = strings.Replace(filepath.Base(filename), "+", " ", -1)
|
var err error
|
||||||
|
if filenames[i], err = url.QueryUnescape(filepath.Base(filename)); err != nil {
|
||||||
|
// this should never error since filepath was escaped using url.QueryEscape
|
||||||
|
filenames[i] = filepath.Base(filename)
|
||||||
|
}
|
||||||
|
|
||||||
ext := filepath.Ext(filename)
|
ext := filepath.Ext(filename)
|
||||||
onlyImages = onlyImages && model.IsFileExtImage(ext)
|
onlyImages = onlyImages && model.IsFileExtImage(ext)
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user