From dca3902fef30fa0836db8c65d01565aa2df88021 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 22 Sep 2026 11:03:16 +0100 Subject: [PATCH] imagekit: fix potential crash in rmdir and purge Rmdir and Purge read the response status code before checking for an error, so a failed DeleteFolder call with no HTTP response (a network error, or purging the root which fails validation) panicked. Thanks to @manus-pi for finding this problem. (cherry picked from commit e2cd9a5dfb3f28978adc58dc7f732a28a47c1f44) --- backend/imagekit/imagekit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/imagekit/imagekit.go b/backend/imagekit/imagekit.go index 44c193ec8..42778d856 100644 --- a/backend/imagekit/imagekit.go +++ b/backend/imagekit/imagekit.go @@ -477,7 +477,7 @@ func (f *Fs) Rmdir(ctx context.Context, dir string) (err error) { FolderPath: f.EncodePath(path.Join(f.root, dir)), }) - if res.StatusCode == http.StatusNotFound { + if res != nil && res.StatusCode == http.StatusNotFound { return false, fs.ErrorDirNotFound } @@ -502,7 +502,7 @@ func (f *Fs) Purge(ctx context.Context, dir string) (err error) { FolderPath: f.EncodePath(remote), }) - if res.StatusCode == http.StatusNotFound { + if res != nil && res.StatusCode == http.StatusNotFound { return false, fs.ErrorDirNotFound }