1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-10 09:02:49 +00:00

trim spaces from file names

This commit is contained in:
2017-08-22 19:27:26 -05:00
parent 892670c98b
commit fd806bf090

View File

@@ -42,8 +42,9 @@ func FileUpload(w http.ResponseWriter, r *http.Request) {
os.Mkdir(config.Config.SoundsPath, os.ModePerm)
}
// convert file name to lower case
// convert file name to lower case and trim spaces
header.Filename = strings.ToLower(header.Filename)
header.Filename = strings.Replace(header.Filename, " ", "", -1)
// check if file already exists
if _, err := os.Stat(config.Config.SoundsPath + header.Filename); err == nil {