do not sanitize from/to langauge codes (closes #58)
All checks were successful
mozhi pipeline / Push Docker image to Codeberg docker registry (push) Successful in 37m36s
mozhi pipeline / Build and publish artifacts (push) Successful in 1h33m40s

This commit is contained in:
2025-01-19 13:46:23 +05:30
parent cf7713461a
commit 254a0446b4
4 changed files with 33 additions and 14 deletions

View File

@@ -55,7 +55,7 @@ func HandleTargetLanguages(c *fiber.Ctx) error {
// @Router /api/tts [get]
func HandleTTS(c *fiber.Ctx) error {
engine := utils.Sanitize(c.Query("engine"), "alpha")
lang := utils.Sanitize(c.Query("lang"), "alpha")
lang := c.Query("lang")
text := c.Query("text")
if engine == "" || text == "" || lang == "" {
return fiber.NewError(fiber.StatusBadRequest, "engine, lang, text are required query strings.")
@@ -117,8 +117,8 @@ func HandleTranslate(c *fiber.Ctx) error {
// @Router /api/image [post]
func HandleImg(c *fiber.Ctx) error {
engine := utils.Sanitize(c.FormValue("engine"), "alpha")
from := utils.Sanitize(c.FormValue("from"), "alpha")
to := utils.Sanitize(c.FormValue("to"), "alpha")
from := c.FormValue("from")
to := c.FormValue("to")
file, err := c.FormFile("image")
if err != nil {
return err