From 5368fd4e1b3ba06a88d201ee464116ca31d8a700 Mon Sep 17 00:00:00 2001 From: Max Holland Date: Thu, 2 May 2024 12:39:18 +0100 Subject: [PATCH] Fix FS delete (#120) --- drivers/fs.go | 3 +-- drivers/fs_test.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/fs.go b/drivers/fs.go index 79e8fa6..e241817 100644 --- a/drivers/fs.go +++ b/drivers/fs.go @@ -7,7 +7,6 @@ import ( "net/url" "os" "path" - "path/filepath" "strings" "sync" "time" @@ -129,7 +128,7 @@ func (ostore *FSSession) ListFiles(ctx context.Context, dir, delim string) (Page } func (ostore *FSSession) DeleteFile(ctx context.Context, name string) error { - return os.Remove(filepath.Join(ostore.path, name)) + return os.Remove(ostore.getAbsoluteURI(name)) } func (ostore *FSSession) ReadData(ctx context.Context, name string) (*FileInfoReader, error) { diff --git a/drivers/fs_test.go b/drivers/fs_test.go index ea034f7..0b9d796 100644 --- a/drivers/fs_test.go +++ b/drivers/fs_test.go @@ -86,7 +86,7 @@ func TestDeleteFile(t *testing.T) { // Try to delete the file u, err := url.Parse(os.TempDir()) require.NoError(t, err) - sess := NewFSDriver(u).NewSession(os.TempDir()) + sess := NewFSDriver(u).NewSession("") require.NoError(t, sess.DeleteFile(context.Background(), filepath.Base(file.Name()))) // Check the file no longer exists