Fix naming file on edit

This commit is contained in:
Thomas Miceli 2023-03-20 13:49:28 +01:00
parent f49f4ca10d
commit 31ea2f650b
No known key found for this signature in database
GPG key ID: D86C6F6390AF050F

View file

@ -209,12 +209,14 @@ func processCreate(ctx echo.Context) error {
}
dto.Files = make([]models.FileDTO, 0)
fileCounter := 0
for i := 0; i < len(ctx.Request().PostForm["content"]); i++ {
name := ctx.Request().PostForm["name"][i]
content := ctx.Request().PostForm["content"][i]
if name == "" {
name = "gistfile" + strconv.Itoa(i+1) + ".txt"
fileCounter += 1
name = "gistfile" + strconv.Itoa(fileCounter) + ".txt"
}
escapedValue, err := url.QueryUnescape(content)