Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

imagekit: fix potential crash in rmdir and purge

Nick Craig-Woode2cd9a5dfb3f
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
}