Skip to content

Commit

Permalink
fix(123&123share): remove X-Forwarded-For header
Browse files Browse the repository at this point in the history
  • Loading branch information
xrgzs committed Oct 4, 2024
1 parent e3ccec0 commit 8d9cfb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
13 changes: 7 additions & 6 deletions drivers/123/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ func (d *Pan123) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
if f, ok := file.(File); ok {
//var resp DownResp
var headers map[string]string
if !utils.IsLocalIPAddr(args.IP) {
headers = map[string]string{
//"X-Real-IP": "1.1.1.1",
"X-Forwarded-For": args.IP,
}
}
// Do not set X-Forwarded-For header
// if !utils.IsLocalIPAddr(args.IP) {
// headers = map[string]string{
// //"X-Real-IP": "1.1.1.1",
// "X-Forwarded-For": args.IP,
// }
// }
data := base.Json{
"driveId": 0,
"etag": f.Etag,
Expand Down
14 changes: 7 additions & 7 deletions drivers/123_share/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ func (d *Pan123Share) Link(ctx context.Context, file model.Obj, args model.LinkA
// TODO return link of file, required
if f, ok := file.(File); ok {
//var resp DownResp
var headers map[string]string
if !utils.IsLocalIPAddr(args.IP) {
headers = map[string]string{
//"X-Real-IP": "1.1.1.1",
"X-Forwarded-For": args.IP,
}
}
// Do not set X-Forwarded-For header
// if !utils.IsLocalIPAddr(args.IP) {
// headers = map[string]string{
// //"X-Real-IP": "1.1.1.1",
// "X-Forwarded-For": args.IP,
// }
// }
data := base.Json{
"driveId": "0",
"shareKey": d.ShareKey,
Expand Down

0 comments on commit 8d9cfb4

Please sign in to comment.