feat: add error handling

This commit is contained in:
Louis Dalibard 2024-04-27 13:58:01 +02:00
parent b3e1b4f212
commit 8e4943d5ae

View File

@ -3,6 +3,7 @@ package route
import (
"leech/config"
"leech/html"
"net/url"
"os"
"path"
"sort"
@ -12,7 +13,11 @@ import (
)
func HandleList(c *fiber.Ctx) error {
req := c.Params("req")
encodedReq := c.Params("req")
req, err := url.QueryUnescape(encodedReq)
if err != nil {
return c.Status(fiber.StatusInternalServerError).SendString(err.Error())
}
c.Set(fiber.HeaderContentType, fiber.MIMETextHTML)
if req == "" {
keys := make([]string, 0, len(config.Config.ServeDirs))