From 35abcadfc701509558483a7d55cbe1c7d4dbff84 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 22 Sep 2026 11:03:16 +0100 Subject: [PATCH] shade: fix potential crash in directory move DirMove discarded the error from the destination check and read the response status code, so a failure with no HTTP response panicked. Other errors were reported as the destination existing; they are now returned. Thanks to @manus-pi for finding this problem. --- backend/shade/shade.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/shade/shade.go b/backend/shade/shade.go index eacbdc37b..21b533ddf 100644 --- a/backend/shade/shade.go +++ b/backend/shade/shade.go @@ -380,9 +380,11 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string //Need to check if destination exists fullPath := f.buildFullPath(dstRemote) var response api.ListDirResponse - res, _ := f.callAPI(ctx, "GET", fmt.Sprintf("/%s/fs/attr?path=%s", f.drive, fullPath), &response) - - if res.StatusCode != http.StatusNotFound { + res, err := f.callAPI(ctx, "GET", fmt.Sprintf("/%s/fs/attr?path=%s", f.drive, fullPath), &response) + if res == nil || res.StatusCode != http.StatusNotFound { + if err != nil { + return fmt.Errorf("failed to check destination directory: %w", err) + } return fs.ErrorDirExists }