Merge pull request 'Fix lecture de document avec caractères spéciaux dans le titre' (#166) from fix/documentation-read-queryunescape into main

Reviewed-on: #166
This commit is contained in:
Victor Lacasse-Beaudoin 2023-10-24 16:22:03 -05:00
commit cb977f767d

View file

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"net/url"
"sort" "sort"
"git.agecem.com/agecem/agecem-org/api" "git.agecem.com/agecem/agecem-org/api"
@ -98,7 +99,12 @@ func (h *WebHandler) HandlePublicDocumentation(c echo.Context) error {
bucket := c.Param("bucket") bucket := c.Param("bucket")
document := c.Param("document") document := c.Param("document")
response, err := h.ApiClient.Voki.Call(http.MethodGet, fmt.Sprintf("/v1/bucket/%s/%s", bucket, document), nil, true) unescaped, err := url.QueryUnescape(fmt.Sprintf("/v1/bucket/%s/%s", bucket, document))
if err != nil {
return c.JSON(http.StatusBadRequest, map[string]string{"message": "Bad Request"})
}
response, err := h.ApiClient.Voki.Call(http.MethodGet, unescaped, nil, true)
if err != nil { if err != nil {
return c.JSON(models.NotFoundResponse()) return c.JSON(models.NotFoundResponse())
} }