From f28bbd810cda5d7885b8bc6dea9cc249c35b55a1 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 1 Nov 2020 23:18:31 -0500 Subject: [PATCH] storage: Fix path to trash directory The trashDir is defined as subdirectory of dataDir, joining it with dataDir again leads to dataDir being included twice. --- internal/storage/fs/storage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/storage/fs/storage.go b/internal/storage/fs/storage.go index 862c74e6..98bc0895 100644 --- a/internal/storage/fs/storage.go +++ b/internal/storage/fs/storage.go @@ -52,13 +52,13 @@ func (fs *Storage) RemoveDocument(id string) error { trashDir := fs.Cfg.TrashDir meta := fmt.Sprintf("%s.metadata", id) fullPath := path.Join(dataDir, meta) - err := os.Rename(fullPath, path.Join(dataDir, trashDir, meta)) + err := os.Rename(fullPath, path.Join(trashDir, meta)) if err != nil { return err } meta = fmt.Sprintf("%s.zip", id) fullPath = path.Join(dataDir, meta) - err = os.Rename(fullPath, path.Join(dataDir, trashDir, meta)) + err = os.Rename(fullPath, path.Join(trashDir, meta)) if err != nil { return err }