mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-19 06:02:01 +08:00
refactor(router): simplify remote address construction logic
This commit is contained in:
parent
0ae84bc419
commit
b7d9419408
@ -107,11 +107,9 @@ func Convert(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 构建正确的远程地址
|
// 构建正确的远程地址
|
||||||
remoteAddr := targetUrl.String()
|
remoteAddr := strings.TrimRight(targetUrl.String(), "/")
|
||||||
if !strings.HasSuffix(remoteAddr, "/") {
|
relativePath := strings.TrimLeft(strings.TrimPrefix(reqURI, matchedPrefix), "/")
|
||||||
remoteAddr += "/"
|
remoteAddr = remoteAddr + "/" + relativePath
|
||||||
}
|
|
||||||
remoteAddr += strings.TrimPrefix(reqURI, matchedPrefix)
|
|
||||||
|
|
||||||
rawImageAbs, isNewDownload, err = fetchRemoteImg(remoteAddr, targetUrl.Host)
|
rawImageAbs, isNewDownload, err = fetchRemoteImg(remoteAddr, targetUrl.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user