mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
尝试修复非图片文件的重定向问题,并优化了代码结构。
This commit is contained in:
parent
0b494e08ac
commit
585f9a52b8
@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.23-bookworm as builder
|
FROM golang:1.23-bookworm AS builder
|
||||||
|
|
||||||
ARG IMG_PATH=/opt/pics
|
ARG IMG_PATH=/opt/pics
|
||||||
ARG EXHAUST_PATH=/opt/exhaust
|
ARG EXHAUST_PATH=/opt/exhaust
|
||||||
|
@ -3,21 +3,19 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"slices"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"webp_server_go/config"
|
"webp_server_go/config"
|
||||||
"webp_server_go/encoder"
|
"webp_server_go/encoder"
|
||||||
"webp_server_go/helper"
|
"webp_server_go/helper"
|
||||||
"slices"
|
|
||||||
"path"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func Convert(c *fiber.Ctx) error {
|
func Convert(c *fiber.Ctx) error {
|
||||||
// this function need to do:
|
// this function need to do:
|
||||||
// 1. get request path, query string
|
// 1. get request path, query string
|
||||||
@ -65,8 +63,6 @@ func Convert(c *fiber.Ctx) error {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
reqURI := c.Path()
|
|
||||||
filename := path.Base(reqURI)
|
|
||||||
|
|
||||||
// 处理根路径请求
|
// 处理根路径请求
|
||||||
if reqURI == "/" {
|
if reqURI == "/" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user