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()
|
||||
if !strings.HasSuffix(remoteAddr, "/") {
|
||||
remoteAddr += "/"
|
||||
}
|
||||
remoteAddr += strings.TrimPrefix(reqURI, matchedPrefix)
|
||||
remoteAddr := strings.TrimRight(targetUrl.String(), "/")
|
||||
relativePath := strings.TrimLeft(strings.TrimPrefix(reqURI, matchedPrefix), "/")
|
||||
remoteAddr = remoteAddr + "/" + relativePath
|
||||
|
||||
rawImageAbs, isNewDownload, err = fetchRemoteImg(remoteAddr, targetUrl.Host)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user