feat: add error handling
This commit is contained in:
parent
b3e1b4f212
commit
8e4943d5ae
@ -3,6 +3,7 @@ package route
|
|||||||
import (
|
import (
|
||||||
"leech/config"
|
"leech/config"
|
||||||
"leech/html"
|
"leech/html"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
@ -12,7 +13,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HandleList(c *fiber.Ctx) error {
|
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)
|
c.Set(fiber.HeaderContentType, fiber.MIMETextHTML)
|
||||||
if req == "" {
|
if req == "" {
|
||||||
keys := make([]string, 0, len(config.Config.ServeDirs))
|
keys := make([]string, 0, len(config.Config.ServeDirs))
|
||||||
|
Loading…
Reference in New Issue
Block a user