Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
fix for memory panic when opening broken file
Browse files Browse the repository at this point in the history
  • Loading branch information
itsToggle authored Oct 20, 2022
1 parent 29c7a24 commit 448781b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/realdebrid/realdebrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
}
fs.FixRangeOption(options, o.size)
var resp *http.Response
var err_code = 0
opts := rest.Opts{
Path: "",
RootURL: o.url,
Expand All @@ -1173,10 +1174,13 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
}
err = o.fs.pacer.Call(func() (bool, error) {
resp, err = o.fs.srv.Call(ctx, &opts)
if resp != nil {
err_code = resp.StatusCode
}
return shouldRetry(ctx, resp, err)
})
if err != nil {
if resp.StatusCode == 503 {
if err_code == 503 {
for _, TorrentID := range broken_torrents {
if o.ParentID == TorrentID {
return nil, err
Expand Down

0 comments on commit 448781b

Please sign in to comment.