mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-11 01:22:48 +00:00
convert file names to lowercase
This commit is contained in:
@@ -3,6 +3,7 @@ package handlers
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"net/http"
|
||||
|
||||
@@ -41,6 +42,9 @@ func FileUpload(w http.ResponseWriter, r *http.Request) {
|
||||
os.Mkdir(config.Config.SoundsPath, os.ModePerm)
|
||||
}
|
||||
|
||||
// convert file name to lower case
|
||||
header.Filename = strings.ToLower(header.Filename)
|
||||
|
||||
// check if file already exists
|
||||
if _, err := os.Stat(config.Config.SoundsPath + header.Filename); err == nil {
|
||||
response.ERR(w, http.StatusInternalServerError, []byte("File already exists."))
|
||||
|
||||
Reference in New Issue
Block a user