mirror of
https://github.com/TeamPiped/http3-ytproxy.git
synced 2024-08-14 23:56:43 +00:00
Fix bug when dealing with encoded paths.
This commit is contained in:
parent
2d96fc49a1
commit
66de98358b
1 changed files with 4 additions and 4 deletions
8
main.go
8
main.go
|
@ -55,7 +55,7 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
|
||||
if len(host) <= 0 {
|
||||
host = getHost(req.URL.Path)
|
||||
host = getHost(req.URL.RawPath)
|
||||
}
|
||||
|
||||
if len(host) <= 0 {
|
||||
|
@ -63,7 +63,7 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
path := req.URL.Path
|
||||
path := req.URL.RawPath
|
||||
|
||||
path = strings.Replace(path, "/ggpht", "", 1)
|
||||
path = strings.Replace(path, "/i/", "/", 1)
|
||||
|
@ -76,8 +76,8 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
|
||||
proxyURL.RawQuery = q.Encode()
|
||||
|
||||
if strings.HasSuffix(proxyURL.Path, "maxres.jpg") {
|
||||
proxyURL.Path = getBestThumbnail(proxyURL.Path)
|
||||
if strings.HasSuffix(proxyURL.RawPath, "maxres.jpg") {
|
||||
proxyURL.RawPath = getBestThumbnail(proxyURL.RawPath)
|
||||
}
|
||||
|
||||
request, err := http.NewRequest("GET", proxyURL.String(), nil)
|
||||
|
|
Loading…
Reference in a new issue