From c8d6b02dd62ba11a5d6aa16585d84cff8b15b6f2 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 8 Jun 2024 16:29:20 +0100 Subject: [PATCH] ulozto: fix panic in various integration tests Before this change some of the integration tests were producing this error panic: runtime error: invalid memory address or nil pointer dereference This was caused by an `fs.Object` of which the type (`*Object`) was not `nil`, but the value within was `nil`. These do not compare as `nil` leading to the panic. This is a classic Go gotcha: https://go.dev/doc/faq#nil_error This was easily fixed by changing the type of one function to return fs.Object instead of *Object. --- backend/ulozto/ulozto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/ulozto/ulozto.go b/backend/ulozto/ulozto.go index 1cdeefd74..d39435aef 100644 --- a/backend/ulozto/ulozto.go +++ b/backend/ulozto/ulozto.go @@ -1020,7 +1020,7 @@ func (f *Fs) CreateDir(ctx context.Context, parentSlug, leaf string) (newID stri return folder.Slug, nil } -func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *api.File) (*Object, error) { +func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *api.File) (fs.Object, error) { o := &Object{ fs: f, remote: remote,