Skip to content

Commit

Permalink
fix(189pc): get real link after redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 6, 2023
1 parent ecbd6d8 commit 623c7dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/189pc/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ func (y *Cloud189PC) Link(ctx context.Context, file model.Obj, args model.LinkAr

// 重定向获取真实链接
downloadUrl.URL = strings.Replace(strings.ReplaceAll(downloadUrl.URL, "&", "&"), "http://", "https://", 1)
res, err := base.NoRedirectClient.R().SetContext(ctx).Head(downloadUrl.URL)
res, err := base.NoRedirectClient.R().SetContext(ctx).SetDoNotParseResponse(true).Get(downloadUrl.URL)
if err != nil {
return nil, err
}
defer res.RawBody().Close()
if res.StatusCode() == 302 {
downloadUrl.URL = res.Header().Get("location")
}
Expand Down

1 comment on commit 623c7dc

@damoncui1993
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you take a look at the issue and give me some suggestions?
#5937

Please sign in to comment.