mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-16 19:52:49 +00:00
added docker support
This commit is contained in:
@@ -35,13 +35,13 @@ func FileUpload(c *gin.Context) {
|
||||
file.Filename = strings.Replace(file.Filename, " ", "", -1)
|
||||
|
||||
// check if file already exists
|
||||
if _, err := os.Stat(config.Config.SoundsPath + file.Filename); err == nil {
|
||||
if _, err := os.Stat(config.Config.SoundsPath + "/" + file.Filename); err == nil {
|
||||
c.JSON(http.StatusInternalServerError, "File already exists.")
|
||||
return
|
||||
}
|
||||
|
||||
err = c.SaveUploadedFile(file, config.Config.SoundsPath+file.Filename)
|
||||
log.Debug("Saving file", config.Config.SoundsPath+file.Filename)
|
||||
err = c.SaveUploadedFile(file, config.Config.SoundsPath+"/"+file.Filename)
|
||||
log.Debug("Saving file", config.Config.SoundsPath+"/"+file.Filename)
|
||||
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
@@ -49,14 +49,5 @@ func FileUpload(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// repopulate sound list
|
||||
err = PopulateSoundList()
|
||||
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
c.JSON(http.StatusInternalServerError, "Error populating sound list.")
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, "Success")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user