Skip to content

Commit 79401dd

Browse files
committed
sign with path instead of filename
1 parent feecb83 commit 79401dd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

alist-proxy.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"fmt"
88
"io"
99
"net/http"
10-
"path"
1110
"strings"
1211

1312
"github.com/alist-org/alist/v3/pkg/sign"
@@ -64,8 +63,7 @@ func errorResponse(w http.ResponseWriter, code int, msg string) {
6463
func downHandle(w http.ResponseWriter, r *http.Request) {
6564
sign := r.URL.Query().Get("sign")
6665
filePath := r.URL.Path
67-
fileName := path.Base(filePath)
68-
err := s.Verify(fileName, sign)
66+
err := s.Verify(filePath, sign)
6967
if err != nil {
7068
errorResponse(w, 401, err.Error())
7169
return
@@ -124,7 +122,7 @@ func downHandle(w http.ResponseWriter, r *http.Request) {
124122
_ = res2.Body.Close()
125123
}()
126124
for h, v := range res2.Header {
127-
if strings.ToLower(h) == strings.ToLower("Access-Control-Allow-Origin") {
125+
if strings.EqualFold(h, "Access-Control-Allow-Origin") {
128126
continue
129127
}
130128
w.Header()[h] = v

0 commit comments

Comments
 (0)