Skip to content

Commit

Permalink
storage: Fix path to trash directory
Browse files Browse the repository at this point in the history
The trashDir is defined as subdirectory of dataDir, joining it with
dataDir again leads to dataDir being included twice.
  • Loading branch information
tbabej committed Nov 2, 2020
1 parent 78ecb8c commit f28bbd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/storage/fs/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f28bbd8

Please sign in to comment.